0

I face a problem when trying to install debug type .apk file over another one on my device. I have an app with versionCode=n already installed. When I try to install the same app with versionCode=n+1 i get an error.

Here is the message after i call the command adb install xxx.apk

failed to install xxx.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package xxx signatures do not match the previously installed version; ignoring!]

All my .apk files are signed with Android debug keystore. It is confirmed by command jarsigner -verify -verbose -certs xxx.apk that gives me next message:

  • Signed by "C=US, O=Android, CN=Android Debug" Digest algorithm: SHA-256 Signature algorithm: SHA256withRSA, 2048-bit key

jar verified.

These .apk files are built via TeamCity CI that just calls assembleDebug command.

It is very strange because I can update release APK files built by CI easily. This problem occurs only in case of debug builds.

Do you have any idea about this? Thanks in advance

David
  • 301
  • 3
  • 10
  • Are you always using the same debug keystore from the same computer? – jeprubio Mar 31 '20 at 09:01
  • Yes I do. Do you mean that debug keystores of single project generated by different computers can differ from each other? – David Mar 31 '20 at 09:04
  • Yes, you should copy your debug keystore to the other computer if you want them to create the same signature. Or just delete the app so that it can be reinstalled with the new signature – jeprubio Mar 31 '20 at 09:05
  • 1
    @jeprubio Im sure that all my keystore files are generated on single PC, however Im grateful for your advice – David Mar 31 '20 at 09:13

1 Answers1

1

Each debug build of your android application will be signed with the debug keystore.

This is a problem because in continous integration environments, like travis-ci or docker, the debug keystore is regenerated on each creation of the environment.

This means if someone has a debug version of your application, they won't be able to upgrade to a more recent version, because the keystores will be different.

Credits to: https://newfivefour.com/android-debug-build-constant-signed-keystore.html

Also to compare if two apks are signed with the same key: check: How do I find out which keystore was used to sign an app?

Traendy
  • 916
  • 7
  • 12
  • Thanks. I will try to create a new build type that extends from debug and build it with custom keystore. If that works I will mark your answer as the right one – David Mar 31 '20 at 09:14