Search code examples
angularcordovaionic-frameworkcordova-pluginszipalign

cordova build --> both debug and release builds are working. But when I do `zipalign` it fails to install on my device


I have created an application using angular and processed it using Cordova.

Now, when I use cordova build android or cordova build --release android I get the desired result i.e. the app is running on my device, even after signing it (with my.keystore) using the below

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my.keystore  name1.apk alias

it works fine till here, but when I attempt to zipAlign the same using

./zipalign -f -v 4 app-release.apk app-final.apk

it shows Verification successful, then when I try to install it prompts--> app not installed on my device. What is possibly wrong here?

Below are the steps in sequence.

  1. put the angular dist build in www folder.
  2. generate keystore using
keytool -genkey -v -keystore <keystorename> -alias <aliasname> -keyalg RSA -keysize 2048 -validity 10000  
  1. add keystore && build.json with keystore password.
  2. run cordova build --release android --> produces app-release.apk
  3. then using zipAlign in buildtools
./zipalign -f -v 4 app-release.apk app-final.apk

Also in play console while uploading the generated .apk. I'm getting following:

You uploaded an APK with an invalid signature (learn more about signing). Error from apksigner: ERROR (Jar signer CERT.RSA): JAR signature META-INF/CERT.SF indicates the APK is signed using APK Signature Scheme v2 but no such signature was found. Signature stripped?

Solution

  • If you have landed here .. my issue was resolved importing the project to Android studio and generating build from there.

    check the referenced question --> Error while trying to upload APK to Google Play