3

I have an existing Ionic application (deployed on Google play) where I have just done a new build with some bug fixes (etc). I have since updated Ionic to the latest version, and updated the Ionic CLI to 3.x etc, but other than that the build is the same (on the same machine), and I am using the same keystore file as before.

However, when I copy the released built apk to manually install on my Android device (as I always do before pushing to the store), and am now getting app not installed. The package appears to be corrupt

If I remove the existing version, then the new apk installs fine. THis is the sort of error I may expect if my signing files (keystore) has been changed, but it definitely has not, I get it from the same saved place all the time. As I have previously successfully done, I copied the key file into the platform/Android folder as described here. The resulting file form the build is android-release.apk so it has been signed.

I now have no idea how to diagnose this problem. I certainly don't want users to have to uninstall first before updating.

Does anyone have any suggestions on what else could be wrong here, and how I can begin to diagnose this?

Thanks in advance for any ideas.

[UPDATE]

Following this post, I examined the contents of the signing certificates using keytool -printcert -file CERT.RSAof the previous and current builds. I have confirmed they have exactly they same contents (as I know they would)

[UPDATE2]

After reading some other posts suggesting it could be the AndroidManifest.xml, I've opened each apk using this suggested app. All the contents look exactly the same except for the versionCode and versionName, which are obviously set to the new version.

eg

file 1

versionCode='9'
versionName='1.0.0'

file 2..

versionCode='6'
versionName='1.0.1'

These exactly reflect the version I have for each build

peterc
  • 4,031
  • 6
  • 40
  • 92
  • The same error happened to me because I have old version signed with different .keystore of the new one in the new version. All what I did I removed the old version. – amrography Aug 19 '17 at 21:07

1 Answers1

4

Finally realised my problem was the version code. I am resetting the build number for each app version, and then was using the android-versionCode (in the Cordova config.xml) to store the build number. But in the Android doco it states this versionCode must always increase. As soon as I set this to 10 (in my case), the apk would upgrade.

Script47
  • 12,869
  • 4
  • 38
  • 59
peterc
  • 4,031
  • 6
  • 40
  • 92