I am trying to build a signed apk for Android platform using cordova. I have already created unsigned apk using cordova --release android. But i am unable to sign usejarsigner and zipalign. kindly help.
-
Why are you unable to use them? Do you get some errors? – Sergey Glotov Aug 09 '16 at 17:15
-
See this question: http://stackoverflow.com/questions/26449512/how-to-create-signed-apk-file-using-cordova-command-line-interface – Nevermore Aug 09 '16 at 17:31
-
I was not giving apk path in zipalign. – Apurva Pathak Aug 09 '16 at 18:20
1 Answers
I have already solved my problem. I am explaining its steps for the people who are still stuck in it:
Create a unsigned apk. Run this command
cordova --release android
after getting to the location of the project.You can find the unsigned apk in project_name\platforms\android\build\outputs\apk\android-release-unsigned.apk
Copy this apk and keystore tool in one folder. Navigate to the folder and sign it using jarsigner present in java. Run this command,
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystorename <Unsigned APK file> <Keystore Alias name>
After this you will be prompt to enter password of keystore.
Go to location of zipalign. (it is present in Android\SDK\build-tools\version)
Run this command
zipalign -v 4 "location of signed apk" "location of aligned apk"

- 20,200
- 11
- 84
- 98

- 692
- 1
- 9
- 22