How to deal with INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES without uninstall? - android

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

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.

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.

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.

This is the command to uninstall the app from device using adb:
adb uninstall <package name>

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.

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.

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

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.

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.

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

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.

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.

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

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!

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

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

Related

Installation failed with message INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES. not able to install any application in a particular device [duplicate]

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".
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.
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.
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.
This is the command to uninstall the app from device using adb:
adb uninstall <package name>
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.
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.
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
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.
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.
I had the same problem until I realised I had the simulator running and adb was trying to install on that
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.
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.
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
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!
I had this problem trying to execute gradle task connectedDebugAndoidTest (or connectedAndroidTest) on Genymotion. Running it on normal emulator solved the problem.
I think , your app installed by other account.( multiple account mode feature ) You can uninstall app in Setting>Apps>"app name"> Uninstall

Android Studio is unable to install my APK

Error below
DELETE_FAILED_INTERNAL_ERROR
Error while Installing APK
Below which I have tried for solving this issues. All of these are not working.
I have tried changing the package name.
I have tried clean project.
I have tried manually delete the app on the device.
In order to run the apk on the device, I need to download the apk by copy and paste the apk to a folder in the device and install from there.
Other weird things are. Only happen one of my device. I can download the apk to another device just fine.
Any suggestion is welcomed. Thanks in advance.
The problem is on my xiaomi device, it auto update to new version, all of sudden the enable of install via USB required to sign in Mi account.
solution

Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE] even if app appears to not be installed

When trying to deploy my app to the Android device I am getting the following error:
Deployment failed because of an internal error: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
I am aware of this question but the app is not installed. It has been removed/partially removed by Visual Studio during the attempt to deploy.
In the past I solved this by downloading the app from the google play store and then removing it from settings->Application manager. However, now i am getting the error "incompatible update" when it is trying to install it.
I tried to remove it using Titanium Backup and few other things but no luck.
EDIT 1
I realised (from #Motz) that I haven't mentioned that the obvious solution doesn't work. Namely, the app doesn't appear in Settings->Apps
I've seen this several times. Usually, it's due to having a signed release version on my phone, then trying to deploy the debug version on top. It gets stuck in an invalid state where it's not fully uninstalled.
The solution that works for me is to open a command prompt and type:
adb uninstall my.package.id
That usually completes the uninstall in order for me to continue development.
No need to do an adb uninstall, just go to your settings->apps and then do uninstall from there. You will see your application grayed out.
The issues usually has to do with a release vs debug version such as #Kiliman noted here.
Uninstalling the application would be enough to avoid this problem.
INSTALL_FAILED_UPDATE_INCOMPATIBLE
but sometimes even uninstalling the message is raised again, it occurs in Android OS 5.0 +, so this is the solution:
Go to Settings > Apps and you will find your app with the message:
"Not installed for this user"
, we have to uninstall manually for all users with the option:
"Uninstall for all users"
You have to make sure the application is uninstalled.
In your phone, try going to settings/applications and show the list of all your installed applications, then make sure the application is uninstalled for all users (in my case I had uninstalled the application but still for others).
I usually face this issue on Android 5.0+ version devices. Since it has multi-user profiles accounts on the same devices. Every app will install as a separate instance for all users. Make sure to uninstall for all the users as below screenshot.
I accidentally had two devices connected.
After removing one device, INSTALL_FAILED_UPDATE_INCOMPATIBLE error has gone.
Uninstall the apk(app that you are working) from your android device and then run again.
You can just add a parameter to run, see:
Run --> Parameters
In field parameters add -cleaninstall
Now just run, they always will do a deep clean before install.
If you are using Samsung Device and by any chance marked your app for Samsung Knox, then you need to uninstall it from My Knox app.
Uninstalling just from General apps won't uninstall it from Knox App. It has to be done explicitly!
Ok uninstall the app, but we admit that the data not must be lost?
This can be resolve, upgrading versionCode and versionName and try the application in "Release" mode.
For example, this is important when we want to try the migration of our Database.
We can compare the our application on play store with actual application not release yet.
In my case. I installed the release-version app. And after uninstall the app from my device. Thing works fine.
Signature Mismatch your Previous Present APP and new APK
So Please uninstall the previous app and gradlew clean and again install apk
react-native run-android
react-native run-ios
Uninstall your app from connected device(emulator or mobile)
got terminal into project folder cd android
3 next run ./gradlew clean it clean your build
4 cd.. and run below
5 react-native run-android
the first, you must uninstall your app in emulator or device, after that you can cd ./android -> ./gradlew clean then build project again (run android or ios) -> solve
uninstall the app from emulate or smart phone and try to run again
In my case i was getting this when switched the Minimum target version of the android and when i changed back to original one (when i created project at first).
So for that uninstalling worked. But when i changed my android version to latest i was getting it again. To fix that, i went to properties of android project and in Android manifest section, i added a package name e.g com.dotnetdreamer.net. If you have already a package name then you can simply rename it to something else.
One simple way is rename your package name and run again
Delete all app files from Phone
To automate the deletion of an app on your phone you can use the steps below. It can be very useful to delete your app and app data on a quick and clean way.
Make a textfile with this code and save it as Uninstall.sh. Go to the folder (where you've put it) of this script in the terminal and do: sh Uninstall.sh YOURNAMESPACE
Now your namespacefolder (including saved appfiles and database) will be deleted.
echo "Going to platform tools $HOME/Library/Android/sdk/platform-tools"
cd $HOME/Library/Android/sdk/platform-tools
echo "uninstalling app with packagae name $1"
./adb uninstall $1
Delete all app files from pc
Make a textfile with this code and save it as DeleteBinObj.sh.
find . -iname "bin" -o -iname "obj" | xargs rm -rf
Go to the folder of your project where you place this script and do in the terminal: sh DeleteBinObj.sh
In case this helps someone,
I deployed my app to google play, when I uninstalled it and tried to run a debug on my device (new version) I was getting this failed update message.
I couldn't see the app in my device (it was already uninstalled) so I:
Installed the first version again from google play
Opened Settings/App/App name
Cleared the Data
Cleared the Cache
Uninstalled the app
Now you can deploy the debug version again to the device :)
Using Ionic with Cordova via command line...
ionic cordova run android --prod
I ran into this and found that I had deleted the release version from a previous test install, but had an old debug version that was hanging out in apps drawer that I missed. I unplugged my device from the computer, opened the app drawer and used "Search apps.." to find all instances of the app to uninstall them. Then I re-plugged in the device to the computer and viola, it worked!
Thanks for the help everyone!
I Hope this will help somebody in the future but simply go to you config.xml, inside the widget tag, change the default id(io.ionic.starter) to your own id. Have a look at this for android package naming.
Uninstalling the application from all users may be the correct solution, but also be sure to check the Secure Folder or something like that for other devices.
I spent 2 hours of my life trying to figure out the reason for the problem (I only have one user on my personal tablet)
The reason I was unable to install the application is because I mistakenly installed the application via direct link from the "Internal Testing" to both current user and my secure folders.
When you have the Secure Folder active, the tablet name appears twice: one or these is the Secure Folder. (accidentally installed on both)
Example here

INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES when install app for the first time

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!
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.
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.
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.
I had APK already on the device > deleting it solved it for me > TNX
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.
This is the only thing that worked for me:
$ adb uninstall com.example.testproj
Hope it helps
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.
try to delete app on the device and then run in ice
I solved this by just removing old app by uninstalling from the device and build again.
Change package name in manifest.xml (example give = package="com.first.rss")
Change name in src
Right click > Refactor > Rename... And give a name.
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.
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.
I had this problem trying to execute gradle task connectedDebugAndoidTest (or connectedAndroidTest) against Genymotion. Running it on normal emulator solved the problem.
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!
That could happen when package in AndroidManifest is different from the package in Java files

Re-installation failed due to different application signatures - AGAIN

I create an APK and install it on the device. All works OK.
Then I try and run the app from Eclipse and it gives the error above. I didn't make any changes or even need recompiling. I tried running it as debug as well as release and both have the same errors.
Something is messed up somewhere as this used to work :(
EDIT: If I want to send out a pre release to users that have a normal install from the market, does that work ok, if I just send them the APK?
This happens when you for example install or run applications with the same package but signed with two different(may be debug) keys. Just uninstall the application and run it from Eclipse againg.
You should be able to uninstall the application (either though the Android App Manager or apk uninstall <application package-path>) and then deploy it. It seems to get confused when you do a proper install then try to deploy a dev build over it.
You may have messed up your debug certificate. Try to remove it from ~/.android/debug.keystore (Linux/Mac OS X); or %USERHOME%/.android on Windows.
then uninstall using adb your app : adb uninstall yourpackagename
And try to launch it again from eclipse.
It is neither necessary nor desirable to perfom an uninstall of the application if, say, you want to preserve user data like settings.
I have had the same problem for a while, and my solution is simply exporting the app (like when publishing, with the release key) and intalling that .apk file on my phone (I attach it to an e-mail and send it to myself).
This will have the same effect as updating it normally through Google Play Store, and all previously saved data is retained.
It may not be as convenient as running it directly from Eclipse, but having to uninstall the application all the time is not such a great solution either.

Categories

Resources