How to create a signed APK file using Cordova command line interface?
I made a sample application named checkStatus
. Now I want to create a signed APK file. So I can install it in different devices for my testing.
For this, I Googled and found this documentation.
As per the document, I switched to my project directory and ran the following command:
keytool -genkey -v -keystore key-name.keystore -alias alias-name -keyalg RSA -keysize 2048 -validity 10000
After I ran the above command, I got a file named key-name.keystore
at projectRoot/key-name.keystore
.
And then I copy-pasted that file into projectRoot/platforms/android/key-name.keystore
.
After that, I created a file named ant.properties
and saved it in projectRoot/platforms/android
.
I wrote the following code inside the file:
key.store=projectRoot/key-name.keystore
key.alias=myApp
After that, I ran the following command to release
Cordova builds android --release
It's throwing the following error:
/home/projectRoot/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: release,-f,/home/projectRoot/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /home/projectRoot/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
So this time, I modified key.store
value in ant.properties
file like in the following way.
key.store=/home/projectRoot/platforms/android/key-name.keystore
Again, I ran the cordova build android --release
command. It throws the same error.
Can anyone tell me what I've done wrong?