Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate non-debug apk from ionic

I am using ionic framework to generate apk for android platform.

After running ionic build android, an android-debug.apk is generated. How can I generate a non-debug apk which is smaller and faster?

like image 293
guagay_wk Avatar asked Dec 06 '15 10:12

guagay_wk


People also ask

How do you make an APK in an ionic capacitor?

In Android Studio menu Main Menu -> Build Bundle(s) / APK(s) -> Build APK(s) . This then pops up a link with which you can open the file location.

Where are APK files in ionic?

Next, we can find our unsigned APK file in platforms/android/build/outputs/apk . In our example, the file was platforms/android/build/outputs/apk/HelloWorld-release-unsigned.


2 Answers

This is my android release shell script

IFY

clear

gulp

ionic build --release android

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore "path/to/your/keystore" "platforms/android/build/outputs/apk/android-release-unsigned.apk" "keystore alias" -storepass xxx -keypass xxx 

/path/to/android-sdk/build-tools/23.0.2/zipalign -v 4 "platforms/android/build/outputs/apk/android-release-unsigned.apk" "android-release.apk"

rm "platforms/android/build/outputs/apk/android-release-unsigned.apk"
like image 158
Peace Pan Avatar answered Oct 13 '22 12:10

Peace Pan


In cordova 6.2.0 you can release an apk with follwoing commands. Since ionic is a wrapper around cordova, this should work.

cd cordova/ #change to root cordova or ionic folder
platforms/android/cordova/clean #clean if you want
cordova build android --release -- --keystore="/path/to/keystore" --storePassword=password --alias=alias_name #password will be prompted if you have any
like image 44
Midhun KM Avatar answered Oct 13 '22 14:10

Midhun KM