i have developed an ionic application, i'd like to build the app into apk, how am i supposed to do that ? any help ?
2 Answers
For simply generating apk for minor testing. Step oneand two is is enough or
ionic cordova platform add android
ionic cordova build android
should do which will build apk on ./platforms/android/app/build/output/apk/debug/ folder. For deploying to android store, Use terminal, cmd, etc from you root project directory, follow these steps. Minify your app for releasing,
ionic cordova build android --minifycss --optimizejs --minifyjs --release
Generate .keystore for your app (do not lose it ever, it is required for updating your app). This step is not required for updating app. You can replace my-release-key.keystore and alias_name as you wish.
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
The above command will ask for password and extra info. Keep password and specified info safely as it is required for signing you app.
Step one will create release apk file inside, ./platforms/android/app/build/output/apk/release/app-release-unsigned.apk. Copy app-release-unsigned.apk file to your root project directory where your my-release-key.keystore is located.
Now run the following command (change .keystore and alias_name if required),
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore app-release-unsigned.apk alias_name
Give required keystore password when asked
Finally run below command to generate final apk
$ANDROID_HOME/build-tools/vno/zipalign -v 4 app-release-unsigned.apk newname.apk
replace newname.apk as per you choice.
for vno. specify android build tools version no. for example.
$ANDROID_HOME/build-tools/28.0.3/zipalign -v 4 app-release-unsigned.apk newname.apk
Now you can upload generated apk into playstore

- 856
- 8
- 22

- 275
- 5
- 13
-
i do have only android studio, what am i supposed to do to get the apk ? any help ? – harish Nov 19 '19 at 11:10
-
you can just run the above commands from your project root directory. Your apk will be generated on ./platforms/android/app/build/output/apk/ folder on your project – Samin Nov 19 '19 at 11:41
-
also make sure java dev kit is installed on your system and present on environment variables – Samin Nov 19 '19 at 11:42
i think you are asking a duplicated question , follow this How to create a signed APK file using Cordova command line interface? contains full information to build apk and sign it

- 401
- 3
- 14
-
yea i know that but the thing is i dont even know what and all to install to get that process done – harish Nov 20 '19 at 07:18