Corrupted Android APK with --release

Hello everyone,

I’m signing and aligning an APK file, but the result is always corrupted. It seems to be a new issue, because I’m used to follow this process with no errors.

I always run the following commands:

1 ionic cordova build android --release

It generates a “app-release-unsigned.apk” file.

2 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore JKS_LOCATION APK_LOCATION APP_NAME

It requests a Passphrase, I put it, and then I receive a “jar signed” message.

3 zipalign -v 4 SIGNED_APK NEW_NAME_APK

It ends with a “Verification succesful”.

This process always worked, but now, when I test the signed&aligned APK in my cellphone, I receive the message “The package appears to be corrupted”.

This is my environment:

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    Node              : v8.9.3
    npm               : 5.2.0
    OS                : Windows 10

May someone give me a hint?

Thanks in advance!

Hi , I had the same issue.
Did you find a solution ?

Hey , I had the same issue.
Did you find a solution ?

I had the same issue, my solution was :

  • ionic doctor check and resolve all the problems even the warning depedencies…
  • ionic cordova platform remove android --> remove the platform (Android for me)
  • ionic cordova prepare android --> create a new platform
  • create a new key with keytool https://ionicframework.com/docs/v1/guide/publishing.html
  • do the jarsigner and zipalign

I hope it will be ok for you !!!