293

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".

3
  • Try going around the problem by running your apk on an actual device, it always works for me Commented Nov 5, 2015 at 12:55
  • It doesn't work for me. ^ @Mr.Derpinthoughton Commented Mar 8, 2017 at 8:03
  • This can also occur when the app is signed twice and the upgrade is signed in the reverse order. See stackoverflow.com/a/13618894/5276890 for more info on this. Commented Dec 31, 2017 at 13:15

16 Answers 16

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.

Sign up to request clarification or add additional context in comments.

8 Comments

@atourney: You would have to copy the previous machine's keystore (e.g., debug.keystore) to your new machine.
Note that the debug.keystore is not in your project directory. It is normally in your ~/.android/ directory. (see developer.android.com/guide/publishing/…)
How could one give the debug package a different name? (e.g. {PRODUCT_NAME} Dev)
@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.
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.
|
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.

2 Comments

yes, uninstall will solve this permission issue. I was wondering whether I could solve this without uninstalling
Got a new phone and had forgotten about this. How do I mark this up twice :)
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.

5 Comments

Great! Worked after command adb uninstall <package name>. Thanks.
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.
@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: I posted an answer with the command just to be more visible for others which may also encountered this issue. Thanks.
I don't understand why this answer has upvotes. He clearly says "WITHOUT UNINSTALLATION"! –
22

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

adb uninstall <package name> 

3 Comments

The question is about how to resolve the issue without uninstallation.
I don't understand why this answer has upvotes. He clearly says "WITHOUT UNINSTALLATION"!
There is no pm flag for replacing package with inconsistent certificate, right? Security intention?
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.

Comments

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.

Comments

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

1 Comment

Yes, it is better and clear answer that the answer from CommonsWare. Thanks
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.

Comments

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.

Comments

1

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

Comments

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.

Comments

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.

Comments

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

Comments

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!

Comments

0

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

1 Comment

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.
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.