$ionic cordova build android
Note: Don’t forget to replace icon.png (1024*1024) and splash.png (2732*2732) in resource folder then run $ ionic cordova resources [<platform>]
Step 1 – Go to the root of the application folder. Then run following command.
$ionic cordova build android --prod --release
Here –prod will remove unnecessary code and compress files data to reduce code. –release to create unsigned apk file (android-release-unsigned.apk) at location ~platforms\android\build\outputs\apk
Step 2 – Now we will create a key, which is a keystore file, makes a signed APK file which then we can upload to an app store.
$keytool -genkey -v -keystore ionicdemo.keystore -alias ionicdemo -keyalg RSA -keysize 2048 -validity 10000
Step 3 – Next step is to actually Sign App with keystore and alias name “ionicdemo” we just created.
$jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ionicdemo.keystore app-release-unsigned.apk ionicdemo
This will change unsigned to a signed version of APK file which now can be uploaded to Play Store.
Note: Sometimes when we try to install Unsigned application APK file on a real device it shows error “Application Not Installed”. This issue will resolve after performing Step 3.
UPDATE: Some time google playstore publisher shows error to zipalign uploaded APK file. Just run below command: Found it here “C:\Users\%USERNAME%\AppData\Local\Android\Sdk\build-tools\27.0.3”
zipalign -v -p 4 android-release-unsigned.apk newdemoapp.apk
Let me know if you face any problem or you have any advice. 🙂