65

I am trying to build and sign an app manually, but I keep getting INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES when installing to the emulator, before I even succeeded installing once.

Just in case, I have attempted to uninstall the app (yes, I gave the right Java package name), but it didn't solve the problem.

I have also tried restarting the emulator and marking the "Wipe User Data" checkbox.

The package name includes our company name, so it could not clash with internal packages.

I haven't found in the internet any other explanation to the error except for "you have another version of the same app already installed", so I'm kind of stuck here.

Thanks!

Ramon Snir
  • 7,520
  • 3
  • 43
  • 61
  • 1
    possible duplicate of [How to deal with INSTALL\_PARSE\_FAILED\_INCONSISTENT\_CERTIFICATES without uninstallation](http://stackoverflow.com/questions/3185444/how-to-deal-with-install-parse-failed-inconsistent-certificates-without-uninstal) – givanse Jun 28 '14 at 18:30

15 Answers15

172

I ran into this issue, too, and the reason was I had the same application already installed, but signed with different key (DEBUG key vs. release key). Removing the old installation manually and reinstalling solved this.

Zds
  • 4,311
  • 2
  • 24
  • 28
  • 1
    It solved problem "[INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]" for me, great thanks! – Rodion Altshuler Mar 07 '13 at 09:06
  • 2
    I've uninstalled the app, but the error is still there. Do you know anything I can do from the shell to wipe all previous data? – ZiglioUK Apr 04 '13 at 21:34
  • 1
    awesome, made my day ! for me, it was not the debug key v/s release key but two debug keys. I use different laptop at work and home. – 10101010 Jul 23 '13 at 07:43
  • 3
    How does this address `...before I even succeeded installing once.` ?? – Peter K. Jul 23 '13 at 12:16
  • @PeterK.: A valid question. I think the problem here is that the description of the question matches multiple underlying problems and then for most who get that error message the situation is slightly different from the OP. I am not sure how this should be fixed; possibly editing the question? – Zds May 07 '14 at 08:15
  • same for me, i switch laptop and uninstall app before deploy is mandatory – bruno777 Aug 10 '15 at 21:20
22

This worked for me:

  • go to settings
  • then select apps
  • select the downloaded onces
  • select the app and Uninstall for all users.

Then everything worked like a charm.

Jyoti Prakash
  • 3,921
  • 3
  • 21
  • 24
  • If the app installed to device by another computer, it gave me certificate error. It worked after uninstall app. Thank you... – pegatron Nov 12 '15 at 13:26
9

Maybe it's not signed correctly? Try to build it with Eclipse or the SDK Ant tasks and compare the APKs. Or use jarsigner to check the signature and make sure it's what you expect.

Nikolay Elenkov
  • 52,576
  • 10
  • 84
  • 84
  • Is this sufficient: `jarsigner -verify __.apk` and output `jar verified.` ? – Ramon Snir Aug 23 '11 at 06:44
  • You might want to try `jarsigner -verify -verbose -certs` to see the actual signing certificate(s) and make sure they are the ones you expect. – Nikolay Elenkov Aug 23 '11 at 06:49
  • All entries have "sm" and the signing key which I have signed with. Is it possible that there should be some special match between the app's code/manifest and the key's information? Because I have not read about any such thing, but might be the case. – Ramon Snir Aug 23 '11 at 06:51
  • Not really. Try another AVD or a real device, your signature is probably fine. – Nikolay Elenkov Aug 23 '11 at 06:56
  • I think I have found the problem. Some of the files (not all, this is why I've missed it before) are signed twice - once using my key, once using `X.509, CN=Android Debug, O=Android, C=US`. I think this is what causes the problem. Do you know which tool might use this? I am using aapt, javac, dx, aapt (again) and apkbuilder. – Ramon Snir Aug 23 '11 at 07:05
  • It is apkbuilder, I am now trying to figure out how to fix it (worse case scenario, though I don't like it, I can just delete the META-* folder before I sign it myself). – Ramon Snir Aug 23 '11 at 07:11
  • 1
    Most probably apkbuilder, check what options you are passing. You probably want `-u Creates an unsigned package.` – Nikolay Elenkov Aug 23 '11 at 07:14
  • Hurray, it worked! I have missed the -u flag for apkbuilder. Thanks for the help! – Ramon Snir Aug 23 '11 at 07:14
8

I had APK already on the device > deleting it solved it for me > TNX

  • Thank you Uninstalling the Application did it for me.This is what I can infer, this error is occurs when the same application(Source) is being build from different machines/environment(OS). OR Use the same key store across different machines to build the APK. http://www.denizoguz.com/2013/01/12/failure-install_parse_failed_inconsistent_certificates/ – Abhijeet Mar 12 '15 at 06:47
5

This is the only thing that worked for me:

$ adb uninstall com.example.testproj

Hope it helps

Darkland
  • 353
  • 4
  • 12
5

I came across this today, and it appears the act of signing the APK more than once that causes this.

When I build with the standard 'ant debug', which automatically signs with the debug keystore, then add files to the APK and resign it with the debug keystore, all steps and verifications give me the expected results, but upon install on a newly factory-reset machine I get this message.

When I build with the standard 'ant release', skipping the password request by pressing Ctrl-C, then add files to the APK and resign it with my private keystore, everything works as expected.

You can use the standard methods to build your APK files, but before you resign it, you need to delete the META-INF directory inside the APK file to unsign it. On Linux/Mac, you can use the command zip -d yourapp.apk "META-INF*".

One more thing: some people have reported problems doing unsign/sign operations on aligned APK files, so if you have the option, you should probably operate on the unaligned ones, then zipalign as the final step.

n8n8baby
  • 493
  • 5
  • 16
3

For each new build, we are running tests on the emulator. Because we wanted to start from a known configuration with each new test run, we are creating a new AVD each time, after deleting the old one:

android delete avd -n ${EMULATOR}
android create avd -n ${EMULATOR} -t 26

Even on this newly-created AVD, we were seeing:

Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]

when installing both the APK to be tested and the JUnit test APK.

What appears to have worked for us is to run:

adb uninstall my.app.name
adb uninstall my.app.name.test

on the newly created emulator, even though this results in

Failure

The eventual installation (after build) shows:

[exec] 1174 KB/s (4430116 bytes in 3.683s)
[exec] pkg: /data/local/tmp/MainActivity-debug.apk
[exec] Success

for both APK under test and the testing APK.

Peter K.
  • 8,028
  • 4
  • 48
  • 73
3

try to delete app on the device and then run in ice

Bill
  • 31
  • 1
2

I solved this by just removing old app by uninstalling from the device and build again.

Mahendra Pratap
  • 3,174
  • 5
  • 23
  • 45
1
  1. Change package name in manifest.xml (example give = package="com.first.rss")
  2. Change name in src
  3. Right click > Refactor > Rename... And give a name.
Avo Muromägi
  • 1,563
  • 1
  • 12
  • 21
1

Just if someone else got this failure, and none of the above solution work, make sure to disable admin privileges for you app if you requested it.

Mostrapotski
  • 425
  • 3
  • 11
1

Had the same issue when working on the app from multiple machines. Despite uninstalling the app from my device, the issue persisted. I found however that the package was still installed for other users on the device.

On your device go to Settings > Applications and click on the package. Then click the menu/option button and select 'Uninstall for all users'.

This should allow the app to install on your device again.

AWebster
  • 141
  • 1
  • 5
0

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

Ognyan
  • 13,452
  • 5
  • 64
  • 82
0

If you have guest users in your device switch to guest user check if your native app is installed already in guest user account delete it Or remove guest user your choice and then run application. Hope this helps!

Nikhil Goswami
  • 75
  • 2
  • 13
0

That could happen when package in AndroidManifest is different from the package in Java files

Ryan
  • 800
  • 1
  • 13
  • 27