INSTALL_FAILED_SHARED_USER_INCOMPATIBLE error during app installation - android

What was the precise error message?
The error message displayed by F-Droid was on the lines of"The new package is requesting a shared user which is already installed on the device and does not have matching signature.". The eror code was INSTALL_FAILED_SHARED_USER_INCOMPATIBLE / -8.
When did I encounter this issue?
When trying to install the app "Termux" from F-Droid. Essentially installing the apk and not from the Play Store.
What have I tried to solve this issue?
Search Stackoverflow for solutions
Uninstall app / Uninstall App for all users
Install App from Play Store and then uninstall it again
Possible Cause:
I previously had the app installed from Play Store and then uninstalled it before trying to reinstall it from F-Droid. This is the most probable cause in my opinion although I wasn't able to reproduce it on another device.
(Preempting my answer) As it turns out /data/system/packages.xml still contained the shared-user entry for the app including the signature. Which explains why I couldn't install the other apk, since they were signed with different key although they're the same apps and opensource.

Problem solved without root access:
I also encountered 'Error (-8): The new package has requested a shared user which is already installed on the device and does not have matching signature." after uninstalling termux in Google Play and attempting to reinstall it from F-Droid.
The phone was not rooted, so the solution suggested above was not available. However I noticed that some accompanying termux apps were still installed, namely termux API, termux tasker and termux styling.
After uninstalling them, as well as emptying the cache of several possibly relevant apps including google play store, google play services and package installer, I was able to install termux, along with the accompanying apps, from F-Droid.

How to solve it:
Warning: This is quite a brachial method to solve this issue. It also requires root access.
Based on one answer on xda-developers by the user tweakradje I have found the following to work for me:
Copy /data/system/packages.xml to another location or your computer.
Edit it with a text editor and remove the xml-block that has the the apps package-id as the name attribute. Example for the app "Termux" in this case:
<shard-user name="com.termux" userId="10102">
<sigs count="1">
<cert [...]/>
</sigs>
</shared-user>
Copy the modified version to /data/system/packages.xml and overwrite the old one.
Clear the dalvik cache ("adb shell rm /data/dalvik-chache/*" or via recovery)
Reboot
Install the apk which should go through this time
Note:
This most probably won't work for system packages (those that start with "android", e.g. "android.uid.system").
Further reading on shared-users:
Explanation of it's constraints
Android-Developer

Related

Without root, can I use adb to downgrade an app (circumventing the [INSTALL_FAILED_VERSION_DOWNGRADE] error)?

I recently purchased a Moto Z Play Droid Edition which is incapable of being rooted or the bootloader being unlocked. In an attempt to remove bloatware, I have removed several apps. I managed to "uninstall" apps following this XDA tutorial, however without root, that merely disables them from the user.
I have used an old version of Google Calendar for several years, and I wanted to be able to install the same .apk that I have used, however Google Calendar was installed as a system app on Stock Android, so I would need to downgrade it. When I try the simple commands of adb install -r -d -f calendar.apk I get
[INSTALL_FAILED_VERSION_DOWNGRADE]
Because I was unable to fully uninstall the Google Calendar app that came with the stock ROM, there must be some remnant that prevents me from installing an older version.
Is there any way to progress and install this apk? Do I need to change something in the AndroidManifest.xml in order to proceed? Is that even possible with a Google app, which is most likely encrypted?
Any other suggestions?
You would need the source to be able to modify the manifest and rebuild. You would need to change the package name, that's the only way to do it.

error code during application install -24 on Rooted device from Google Play Store

I am trying to install the App from Google Play Store. Gets downloaded and fails during installation with:
unknown error code during application install -24
The Same Application got installed with different certificate during debug runs from Android Studio. Now it is not getting deleted or over written. How can i clear the cache completely?
Connected the Mobile using USB and tried to run debug from Android Studio. I get following error on debug run APK transfer.
Failure [INSTALL_FAILED_UID_CHANGED]
Deleting the app through Terminal using adb shell command helped in one of the mobile.
In other mobile, even adb shell command did not work out.
Resetting mobile to Factory setting as final solution helped.
PS: Please voteup if you find this helpful.Thanks
Check manifest file and compare with previous one.
If your manifest file contain android:sharedUserId in previous version and it is absent in current version then this error will occured.
Solution is uninstall it and install fresh copy.
The main cause of Google Play Store Error Unknown Error Code During Application Install: 24 is cache problem. However, it can arise at different aspects as listed below:
It can be due to Google Play Store Cache and Data problem.
It can arise due to unwanted junk and residue files.
This error can also appear if you are trying to install an app which was earlier installed in your phone and was uninstalled but all the files of the app was not deleted from your phone.
It can also be caused if your internal storage is full.
Depending on the causes, there are 5 Solutions to Fix Google Play Store Error Unknown Error Code During Application Install: 24. They are listed below:
Solution 1 – Restart your Android Phone.
Solution 2 – Clear Cache and Data of Google Play Store, Google Service Framework and Download Manager.
Solution 3 – Remove Junk files from your internal storage.
Solution 4 – Check if you have sufficient memory in your internal storage.
Solution 5 – Factory Reset your Android Phone.

Google Maps not installing?

I have Jellybean 4.2.2 on my phone. (I haven't rooted my device)
I recently updated Google Maps but it wasn't working. So I uninstalled it and tried to do a new install. Every time I try to install it from Play Store, an error message is displayed saying the process could not be completed and the installation cancels after every 65% completion.
I even tried installing it on my phone via the .apk file but to no use. An error message was displayed saying package could not be parsed.
Please help me out, I have searched many forums but couldn't find a suitable solution to my problem.
Thanks in advance.
While downloading from play store make sure you have a good speed internet connection.
You may get the Error "There is a Problem Parsing the Package" Due to following Reasons:
The Downloaded .apk file is Currupted or not fully downloaded
You might have turned off “Allow installation of apps from Unknown Sources”
If the App is not Compatible with the Hardware or the Version of OS you are using.
You may be able to fix the problem trying any of the steps described below:
1. Allowing Installation from Unknown Sources:
- Go to your Device Setting Menu
- Scroll down and Click on Applications
- Now Check the Box of Unknown Sources to allow installation of non Market Applications
After Completing the Above Simple steps you may now try and install the app.
2.Inspect Your APK File:
If the Above Fix do not work then you may inspect the apk file. Check that the file is Fully downloaded and is not Corrupted.
If you have downloaded the apk file from any other place rather then Google play store then Make sure you download it from Google play store this time and try to install it.
3.App is not Compatible with your Device or OS:
If you are still not able to Get rid of the error then it clearly indicates that the file that you have downloaded is not Compatible with your Device hardware or Operating System.

Why will my signed apk not install?

I have been developing my app for a while and runing on a real device through Eclipse using Run As -> *Android Application*.
Now I am trying to distibute it to some beta users for the first time.
I used Eclipse to create a signed app, using a new keystore that I generated through the wizard. This appeared to work fine and when I check with Jarsign I get the message "Jar Verified", although there are a couple of warnings too. These are "This Jar contains entries whose certificate chain is not validated" and "Ths Jar contains signatures that do no include a timestamp".
I then copied the resulting apk onto the device and opened it. But got a message "This app was not installed". And in log cat I can see:
"Package has no certificates at entry ; Ignoring!"
I found some people had suggested going back to JDK 6 (I did have 7 previously), but that didn't help.
A few people suggested it might be due to duplicate activities in the manifest so I checked the manifest thoroughly.
What I have found is that if I rename the apk so that it is no longer exactly the same name as the last part of the package it suddenly works.
So if the package is com.mydomain.myapp and the apk is myapp.apk I get the error, but if it's myapp_debug.apk it installs just fine.
I find this very confusing and more than a little worrying. I would like to publish this app for real eventually and I'm not sure if I've done something wrong.
Based on your renaming makes it work description, you already have an app with the same package name installed on the device, but signed with a different certificate (probably the debug certificate used for eclipse-launch installs).
You must simply remove the existing installation before you install your release version. You can do that either from the settings menu, or with an ADB command of the form
adb uninstall your.package.name
Note that this removal will wipe out the private data stored by the app - that's part of why you have to do it, to prevent an imposter (naturally having a different certificate) from easily grabbing data left behind by a real app.
Remember also when distributing apps to others in this manner that they will need to allow unknown / non-market sources in their settings menu.

Android INSTALL_FAILED_UID_CHANGED

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.

Categories

Resources