292

I tried to reinstall an apk

$adb install -r new.apk

And it shows the error:

Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]

One solution is to uninstall and install the new.apk, that works fine.

But I'm wondering whether I could re-build an apk and re-install without the uninstallation. Eg. change some config in the AndroidManifest.xml, or not sign the APK, etc.

It would be great appreciated if you could tell me the whole meaning of the "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES".

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
Johnny
  • 6,239
  • 7
  • 29
  • 36

16 Answers16

326

It means the new copy of your application (on your development machine) was signed with a different signing key than the old copy of your application (installed on the device/emulator). For example, if this is a device, you might have put the old copy on from a different development machine (e.g., some other developer's machine). Or, the old one is signed with your production key and the new one is signed with your debug key.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I'm running into this error after switching to a new machine. Can I use the signing key from the old machine somehow? How would I find out what it was? – atoumey Dec 14 '10 at 05:53
  • 6
    @atourney: You would have to copy the previous machine's keystore (e.g., `debug.keystore`) to your new machine. – CommonsWare Dec 14 '10 at 11:05
  • 12
    Note that the `debug.keystore` is not in your project directory. It is normally in your `~/.android/` directory. (see http://developer.android.com/guide/publishing/app-signing.html#debugmode) – ohhorob Feb 10 '11 at 06:52
  • 3
    How could one give the debug package a different name? (e.g. {PRODUCT_NAME} Dev) – sandstrom Sep 22 '11 at 10:46
  • Great answer. The follow on question is: We have 1 piece of hardware to share between 2 devs. What's the best way to achieve this (what if we bring on more devs)? – Christian Bongiorno Jun 19 '13 at 21:01
  • 6
    @ChristianBongiorno: Synchronize your signing keystores (e.g., `debug.keystore`). Pick one to be your master keystore, copy it to all the other developer machines, replacing their existing keystore. – CommonsWare Jun 19 '13 at 21:36
  • 2
    Don't forget to rebuild your project after copying the file across too. I moved the files and re-sent the application to the device (but it was still using the old `debug.keystore`). Once I rebuilt the project (using Build->Rebuild in Android Studio) the keys were then in sync. – Benjamin Kaiser Jul 18 '13 at 06:12
  • Uninstall app from the emulator and installing new apk works. – aashish Jul 12 '17 at 20:14
50

I ran into this while testing on a new Xoom. I had previously installed my app from the Marketplace. Later while trying to test a new version of the app I ran into this error.

I fixed it by removing the app that was installed via Marketplace (just hold and drag to the trash). Thereafter I was able to deploy my development version without any issue.

George Armhold
  • 30,824
  • 50
  • 153
  • 232
24

This happened to me when another developer on the team built our app on the hardware device I was trying to deploy to. Uninstalling the app from hardware fixed my problem.

supermoogle
  • 1,207
  • 10
  • 7
  • 17
    Great! Worked after command `adb uninstall `. Thanks. – Paul Jan 08 '13 at 07:30
  • I had a more unique case, but this answer lead to the solution. I had an app installed through the cordova CLI locally and also one installed from the PG build. I had to uninstall both of the apps for the error to go away. – DemitryT Jun 28 '14 at 20:30
  • @Paul Your excellency - King Paul I, while i'm not the original questioner, your command worked for me(and no doubt others given how upvoted your comment is). Can I suggest you post that as an answer? – barlop Aug 12 '14 at 01:40
  • 1
    @barlop: I posted an answer with the command just to be more visible for others which may also encountered this issue. Thanks. – Paul Aug 13 '14 at 13:52
  • 4
    I don't understand why this answer has upvotes. He clearly says "WITHOUT UNINSTALLATION"! – – Christian May 08 '15 at 13:20
22

This is the command to uninstall the app from device using adb:

adb uninstall <package name>
Paul
  • 3,812
  • 10
  • 50
  • 73
9

I got this error even after uninstalling the original APK, which was mystifying. Finally I realized that I had set up multiple users on my Nexus 7 for testing and that the app was still installed for one of the other users. Once I uninstalled it for all users the error went away.

inky
  • 1,462
  • 14
  • 17
6

I changed the package name while coding an update so that I could debug it on my device via Eclipse, without deleting the old version that was installed. Without reverting the package name I was using when trying to reinstall, I got this same error. Using the same package name the reinstall was successful.

Edward
  • 61
  • 1
  • 1
3

I faced an another use case where I got the similar error. When At first I got the error, I panicked, and removed /data/data/{package.name} After that I tried, and my problem was still present. Then I tried uninstall, it failed.

I then removed the apk file present in /system/app (required root access), and tried uninstall and it was successfull.

After that I tried re-installing the apk, it worked.

Arunkumar
  • 3,812
  • 3
  • 22
  • 30
3

Just delete the old build from the device and reinstall the same. Because device.keystore is already exist in the device so just uninstall the build and reinstall the APK thats all..

Thanks

3

If you encounter a failed deployment to an Andorid device or emulator with the error "Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]" in the Output Window, simply delete the existing app on the device or emulator and redeploy. Debug builds will use a debug certificate while Release builds will use your configured certificate. This error is simply letting you know that the certificate of the app installed on the device is different than the one you are attempting to install. In non-development (app store) scenarios, this can be indicator of a corrupted or otherwise modified app not safe to install on the device.

Linda Z
  • 312
  • 1
  • 5
1

I had the same problem until I realised I had the simulator running and adb was trying to install on that

Martin Lockett
  • 2,275
  • 27
  • 31
1

For what it is worth, I ran into this problem after adding a new plugin to my Cordova project. I had been having cordova do builds and install directly on the device via USB.

I fixed it by uninstalling the app from the device and on the next deploy there were no problems.

0

Nothing from above worked for me. The problem for me was that I had wrong source in my Java Build Path for android-support-v7-appcompat. When you go to Project> Build Path> Configure Build Path>. Under the Source tab make sure you have android-support-v7-appcompat/gen , android-support-v7-appcompat/libs and android-support-v7-appcompat/src and nothing else. Click OK and it should work.

Immortal Code
  • 101
  • 1
  • 5
0

I've had the same error today, but the problem wasn’t exactly the same. I’m using ADB with Android installed in VirtualBox. I tried to install different versions of my app (signed / not signed, debug / release mode) and got two errors alternatively : INSTALL_FAILED_UID_CHANGED and INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES.

Now, when looking at /data/data/{package.name}, I found a bunch of files that were still there after uninstalling the app. I tried to rm -rf them without success : I got I/O errors.

The solution to this was :

  • Shut down the VM
  • Mount the VDI image with vdfuse (read/write)
  • Repair the Partition1 image file with e2fsck
  • Umount and restart the VM
Jérôme
  • 175
  • 1
  • 10
0

Since the verification is based on package's name, you can change the package name inside your config.xml or manifest file for another name you want.

When publishing your app don't forget to change back the name!

Raphael
  • 69
  • 1
  • 2
  • 9
0

I had this problem trying to execute gradle task connectedDebugAndoidTest (or connectedAndroidTest) on Genymotion. Running it on normal emulator solved the problem.

Ognyan
  • 13,452
  • 5
  • 64
  • 82
  • I was also getting this on same situation (testing with Genymotion). Turns out that it was a conflict with the signature for the test package. Removing the test package solved the problem. – Amaro Oct 09 '17 at 21:35
0

I think , your app installed by other account.( multiple account mode feature ) You can uninstall app in Setting>Apps>"app name"> Uninstall