Android INSTALL_FAILED_UID_CHANGED - android

I have been doing debugging on Android using my Nexus 4, however I recently encountered this error here. After doing some research on this error, it seems to be an issue with the app not being deleted properly. The app I am debugging runs fine on my other Android devices as well as the emulators, this error is only occuring on my Nexus 4. I plugged my device into computer, and have tried deleting the data/data folders but I am still getting the same issue. I also checked settings-apps to check it was definitely uninstalled.
Does anyone have any idea how to resolve this issue? According to some users, I need root access to properly delete data/data, is this true? Or is there another way around this?

Sometimes you have to also uninstall the data folders. For me, I had a package in userspace of com.kikin.cts, and also a folder directory in /data/data/com.kikin.cts. Kept getting INSTALL_FAILED_UID_CHANGED, but after removing the data folder, the error went away.

For rooted devices:
Run the below command
adb rm -rf /data/data/<your.package.name>
For non-rooted device:
Change the ApplicationId of the app. Refer this link to change
ApplicationId.
Build and install the app. App will install successfully because it is treated as new app.
Now uninstall this app. Which will clear the data.
Now change the ApplicationId to the previous one.
Build and install. Magic.. It will install.

Restart your device, and clear your project.
Basically , uninstalling would have done this for you in case if doesn't then try restarting.

You probably introduced an SharedUserID which causes this.

In most cases INSTALL_FAILED_DEXOPT or INSTALL_FAILED_UID_CHANGED means that you have not enought space to install the app.
Remove some unused apps from your device or at least remove current version of your
app.
adb uninstall package-name
In very rare cases there may be problem with application data. You have two options depending on whether your device is rooted or not
Non-rooted
Factory reset Settings -> Backup and reset -> Factory data reset (at least for Samsung S5)
Rooted (or emulator)
adb shell "rm -rf /data/data/package-name"

I got another solution working for me. You can change the package name of application, so that device recognizes it as different application and installation completes successfully. Might be helpful for those who don't have root access and also don't want to reset device.

I do have root on my Nexus 5, but nothing worked, so I had to run a factory reset from the settings which worked.

For me the trick was done by unchecking "Verify apps over USB" in the "Developer options" section.

Thought I'd share this in case it helps someone... I wrote a new version of my app in eclipse and tried to run it on my phone despite having a slightly older version on the phone that I downloaded from Google Play store. Eclipse popped up a dialog asking if I was happy to uninstall the existing on-phone version and I agreed. The uninstall was defective and led to INSTALL_FAILED_UID_CHANGED.
I tried most of the things suggested here with no luck. There was no apparent trace of the APK on my phone, or any data files I could find to delete, but something was preventing me from loading the APK onto the phone from eclipse. I also could not download my previous beta-testing version from Google Play - the download proceeded to 100% but then failed with a message reporting "unknown error", and a number (probably -24).
I was hesitant to rename my package because I already have beta testers and in-app products set up with the old package name, but I changed the package name in eclipse temporarily and I was able to install that new version onto the phone and then download the older Google Play version as well. Both versions sat happily beside each other on the phone with the same app name and icon (but different package names behind the scenes). I could then manually uninstall either or both by dragging the app icon to the uninstall icon of the phone. The manual uninstall removed the conflict and repaired eclipse's defective uninstall, so I simply renamed my eclipse package to the original name and carried on as before.
This was much less painful than a factory reset or permanent package rename. It probably only works when the source of the error is a conflict between an eclipse version and a Google Play version, but it is worth a try if you are in a similar situation.

This worked for me:
adb shell rm -rf /system/app/<package.name>

From the ADB shell you can find solution in two ways. 1. keep the data and find the solution and 2. solution without persisting the data
solution for 1. is to run the commandadb chown -R UID:UID /data/data/your.package.name through command prompt from ADB path.
solution for 2. is to run the command adb rm -r /data/data/your.package.name from the same path.

I was experiencing this issue for the past couple days on my Galaxy Note 3 test device. I have been using Calabash-Andrdoid and kept getting an error INSTALL_FAILED_UID_CHANGED, whenever the install_app method tried to execute. I was struggling with this issue because I had two test devices experiencing this. I tried everything above, including emptying out my /data/data/ app and app.test folders. I even deleted the instrumentation back-end stuff that Xamarin installs since that's the platform I used to develop my app. I could not find anything else to manually delete off of the device. When I attempted to do my work on third device and found that everything ran successfully, I realized the issue was with the devices. In the end, the only thing that worked for me was to execute a factory reset of one of the devices. I hope this helps.
Thanks,
-Shah

Here's something not covered by the existing answers. This was happening to me on emulator. If I reset user data, I get INSTALL_FAILED_DEXOPT the first time, but INSTALL_FAILED_UID_CHANGED after that. I found that rm -r /data/data/com.foo.bar is enough to reset to the first state.
The actual culprit in my case is a java method name that caused dexopt to fail. Pay very close attention to what's in logcat. Here's what gave it away:
I/PackageManager( 1275): Running dexopt on: com.foo.bar
E/dalvikvm( 2857): Invalid name: '__jni_setLocation'
E/dalvikvm( 2857): Trouble with item 14787 # offset 0x43b68
E/dalvikvm( 2857): Cross-item verify of section type 0005 failed
E/dalvikvm( 2857): ERROR: Byte swap + verify failed
E/dalvikvm( 2857): Optimization failed
W/installd( 941): DexInv: --- END '/data/app/com.foo.bar-1.apk' --- status=0xff00, process failed
E/installd( 941): dexopt in='/data/app/com.foo.bar-1.apk' out='/data/dalvik-cache/data#app#com.foo.bar-1.apk#classes.dex' res=65280
W/PackageManager( 1275): Package couldn't be installed in /data/app/com.foo.bar-1.apk
I can't tell you why dexopt doesn't like some method names, but that was the problem.

Okay, so for my LG NEXUS 4 rooted here is the solution: (
make sure you have somewhere your working app apk signed or unsigned)
and
you uninstalled this file from your phone (if exists of course)
Let's say it is: app-debug-unaligned.apk
Now in console you write:
adb push app-debug-unaligned.apk /sdcard/
adb shell
su
rm -fr /data/local/tmp/app-debug-unaligned.apk
rm -fr /data/data/app-debug-unaligned.apk
Now exit from adb and call
adb shell su -c "pm install /sdcard/app-debug-unaligned.apk"
Working?

I deleted /data/data/my.package.name and /data/app/my.package.name.apk,
problem still persistent.
however I found a folder /data/user/0/my.package.name, delete it and problem solved.

Just uninstall the app itself (not the data folders) then reinstall it, and it should be fine. Android's complaining because you may have previously debugged the app from another computer.

A solution for non-rooted device. Go to the Application manager and uninstall the app called "Selendroid" and retry again. This solution works for me.

I fix this, maybe it will work anyone else.
I'm restart my phone, then remove a few more app.
And try again to install, it's work!
Maybe problem is about to storage. I don't know why, but it's work now. Good luck! (Sorry about bad English)

Use
adb shell
go to the shell.
Then run the command follow:
rm -rf /data/data/package name
please repleace package name with your own, such as com.map.map

For anyone running Junit style tests from their computer and getting this error- while the console it told me there was a problem with my application (packaged in the format 'com.myapp.stuff'), the real issue was my test code package, which if you're running on a device gets installed as a separate app with the package name like 'com.myapp.stuff.test'. Deleting the test code "application" using the Application manager and deleting my actual app solved the problem for me. I'm posting this answer here to save someone else a "Duh" moment.

Same problem on a Mediacom device, first a
$ adb install -r platforms/android/out/android-debug-unaligned.apk
3958 KB/s (22887489 bytes in 5.647s)
pkg: /data/local/tmp/android-debug-unaligned.apk
Failure [INSTALL_FAILED_DEXOPT]
then a very persistent:
$ adb install -r platforms/android/out/android-debug-unaligned.apk
4949 KB/s (22887489 bytes in 4.515s)
pkg: /data/local/tmp/android-debug-unaligned.apk
Failure [INSTALL_FAILED_UID_CHANGED]
Doing a factory reset didn't change the dynamic (I got both errors, in sequence).
installing the same app with a different id worked
installing a different app with the previous id doesn't
Rooting not an option, the solution for me was a cache wipe: now the offending app id works fine and I didn't had to factory reset (again).
Hope it helps

For me, there was a bit more to it. Simply removing /data/data/appfolder didn't help.
The additional reason was that my external libs weren't included in .apk file because the name of folder was lib instead of libs. This has caused [INSTALL_FAILED_DEXOPT] during apk installation followed by [INSTALL_FAILED_UID_CHANGED].
So changing libs folder name worked for me in this case.

I found a solution that works both on a non-rooted device and on an emulator.
While you can't directly delete the data folders on a non-rooted device you can utilize the pm command to do that:
Run adb shell
Run pm uninstall <app name> (i.e. com.example.myapp)
Run pm uninstall <test app name> (i.e. com.example.myapp.test) - you might receive an error if the test app wasn't installed before.
It seems that for some reason when uninstalling the apps from the Android UI this doesn't work (possibly it doesn't delete the data folders) however when uninstalling via the pm command it does work.
Tried it on a "Nexus 5" and on a "OnePlus One".

It is obviously because of improper uninstall (probably due to faulty cable connection).
SOLUTION
Download SDMaid from play-store, and delete Corpse files (junk files).
Re-run application. (But you need to have your device rooted)

I met the similar problem. The reson is that you didn't uninstall all component of the app.My solution is:
deleting /data/data/com.eg.android.AlipayGphone manually.
work well for me.
I hope it is helpful for u!

This happens when installing an update to an application, and the updated version cannot run with the same user ID as the previous version.
Why this happens
Android normally assigns user IDs on its own, and when an app is updated, it inherits the user ID of the previous version. There is one exception: Android allows multiple apps to run on the same user ID if they specify it in their manifest (by setting the android:sharedUserId attribute in the <manifest> element). If the new version requests a shared user ID but the previously installed one did not, the user ID will change and you will get an error. (Presumably also when trying to upgrade from a shared user ID to a version without.)
The error you get depends on the Android version: on Android 4.4.4 I have seen INSTALL_FAILED_UID_CHANGED, whereas Android 10 reports INSTALL_FAILED_SHARED_USER_INCOMPATIBLE.
You may also get this error if the app was uninstalled without removing its data (which can be done via adb shell and pm uninstall -k—if you know what you’re doing).
Two app data locations come into play here:
App-private storage. This data is not normally accessible to end users; if you have root access, you can find the data in the file system ad /data/data/packageID.
Private shared storage: this resides on your SD card at /Android/data/packageID.
How to recover
Recovering from this essentially means ensuring that there is no package (or leftover app data) with the same package name and an incompatible user ID. There are multiple ways to achieve this:
If you have root permission on your device, you can perform some surgery to preserve your app data across the update:
Back up existing app data, delete the existing version, reinstall the new one and restore the data. Here’s how:
Using oandbackup or similar, back up your app’s private data. (You don’t need to back up the APK but it doesn’t hurt.)
If your app has a private shared storage directory (/sdcard/Android/data/packageID), open a shell on the device, enter su to switch to root mode, and rename the directory (changing the package ID to a nonexistent one). This will also change file ownership for the directory from the app’s user to sdcard.
Uninstall the existing app.
Install the new version.
Restore the app’s private data (not the APK) using the same backup tool as above.
If you have moved a private shared storage directory away, move it back to its old location (same steps as above). This will chage the file owner to the (new) user ID of the app.
If you do not have root permissions on your device, your options are somewhat more limited.
Uninstall the existing app, then install the new version. You will lose the app’s private data. If your app has a private shared storage directory (/sdcard/Android/data/packageID), you can (probably) back it up before uninstalling and restore it after installing the new version. The more recent versions of Android support backing up private app data if the app allows it; you might be able to save your app data this way with a backup app, but I haven’t tried this.
If you have uninstalled the old version already but kept the data, reinstall the old version, then proceed as above (uninstall and install new version).
If you are just trying something out, you can give the new version a different package name. That will make Android (and app stores) treat it as a different app. The new version will not see the private data of the previous one, and if you deploy the app with the changed package name to an app store, it will appear as a different app rather than an upgrade to an existing one. This is definitely not recommended in production but may serve you in a lab setting.
If nothing else works, perform a factory reset. This is even more destructive and will delete all your apps, along with their data.

Rooting and factory reset were not an option for me, but I was able to find an older version of my APK and install that (I'm guessing it was the same one that failed to uninstall properly). After uninstalling that one again, I was able to install new versions.

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

Cant Deploy To Real Android Device Xamarin

My problem is related to this post
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE] even if app appears to not be installed
I am not able to deploy my app on a real device it works properly on the emulator , i get deployment error, but nothing in the errors tab.
This is from build output
2>Build succeeded.
2>An error occured. See full exception on logs for more details.
2>The installed package is incompatible. Please manually uninstall and
try again.
2>
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
even after uninstalling the app i was not able to deploy my app on my real device , other apps install fine thorough VS.
There is no specific solution available for this problem , i think the reason is your phone OS doesn't completely uninstall your app, the app signature still lingers on(happens with heavily customized android, in my case its MIUI 8 ).
I found out using logcat - signatures do not match the previously installed version
Potential Solution 1:
Use Titanium Backup (Requires Root) to remove the app folder completely after uninstalling the app.
Potential Solution 2:
Go to settings and remove the app from there , make sure to use the option uninstall for all users(in MIUI 8 this wasn't available)
Potential Solution 3:
Use adb to uninstall your app completely its same as uninstall for all users.
adb uninstall yourpackagename
Incase you dont know it check in properties of your android solution.
Another way to find it
how to delete an app from adb without knowing it's package name
adb root
Then enter adb shell
adb shell
Find out your apps package name:
pm list packages | grep "your app name/something related to your app
name"
Then use:
adb uninstall
OR
pm uninstall
Potential Solution 4:(Not really a Solution)
Change the app package name - wont conflict with the one you have already installed
Note:Doing a hard reset of your device should solve the issue obviously.
In my case 4th option worked, if anyone knows how to remove the previously installed app signature from android please let me know i will update the answer accordingly(probably requires an in-depth knowledge of the file system).
There have a Simple hack
if a Brand new application - then simply Change Android Package Name and Deploy from VS
if already play store publish one - then install app through play store and uninstall. then deploy from VS
this Works for me
A quickly solution is by changing the package name in android manifest.
Go to real device Settings->Apps->All Apps, Now uninstall all the xamarin and mono packages as well as if the Debugging App is there also uninstall it and run again, This solved my same problem.
I know this is an old question, but it could be due to your build configuration. The Release and Debug configurations can and should be different w/r/t manifest entries, etc. I get the ADB0030 error if I try to deploy my Debug configuration. FYI.
I've tried to uninstall app and it has disappeared from Finder. However I received this error. Then I've used a utility (ie. Service Disabler) and the utility listed the app, then I've uninstalled by using utility's Uninstall menu. All gone.
If you have this problem, that's simple, if you have an older .apk of your application, then install this .apk, and after you uninstall.
This is the simple solution.
I had the same problem and I solved it by disable ransomware protection in Windows 10
I installed the app from Play Store, and then uninstalled from there. This seemed to remove it correctly from the device.

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

How to deal with INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES without uninstall?

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

Categories

Resources