INSTALL_FAILED_SHARED_USER_INCOMPATIBLE while using shared user id
Asked Answered
L

11

45

I am working on Android application which will share the database. For that, I'm using android:sharedUserId in both application's Manifest file. When I am trying to run the application after adding that sharedUserId it shows me following errors in console.

[2013-03-04 19:37:32 - MainActivity] Installation error: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE
[2013-03-04 19:37:32 - MainActivity] Please check logcat output for more details.
[2013-03-04 19:37:32 - MainActivity] Launch canceled!

Please help me to resolve this problem.

Ligation answered 4/3, 2013 at 15:33 Comment(6)
Have you signed them with the same key?Fabozzi
I Tried to assign the same key But I found that we can assign keys to apk only... But I want to debug both applicationsLigation
So sign them both with the debug key.Fabozzi
you need to use the same signature for bothBering
Can you please tell me how can I assign them with same debug key or signatureLigation
"I using android:sharedUserId in both application's manifest file" -- this is a bad idea. Please use standard means for sharing data between applications, such as a ContentProvider.Orlandoorlanta
L
52

Follow these steps to fix the INSTALL_FAILED_SHARED_USER_INCOMPATIBLE error:

  1. Remove the existing application (if it was already installed)
  2. Remove the sharedUserId from AndroidManifest.xml
  3. Rebuild the application
  4. Reenter the sharedUserId to AndroidManifest.xml
  5. Rebuild the application (one more time)
Ligation answered 26/3, 2013 at 13:11 Comment(4)
Shared user ID's exist for a reason. If you remove it, either your app won't work as expected or the shared user ID wasn't necessary in the first place. To actually fix the problem, uninstall the other apps that use the same shared ID and install APK's that were built and signed the same was as the other(s).Dahomey
Removing just the apps using the same sharedUserId works as spaaarky21 stated.Emmi
Worked for me .Alimentation
remove,reenter,rebuild is working for meClericals
D
13

This means something about your app was not correctly uninstalled. This steps help to force uninstall from internal commands:

  1. Connect your phone to PC with usb
  2. From your shell launch:
    $ adb shell
    shell@android:/ $ su
    shell@android:/ # pm list packages | grep <part of package>
    package:com.android.providers.applications
    package:com.android.providers.calendar
    package:com.android.providers.contacts
    package:com.android.providers.downloads
    ...
    shell@android:/ # pm uninstall <package>
    shell@android:/ # exit
    shell@android:/ $ exit
    $

Basically, you log into android shell, become superuser, find problematic packages, and uninstall it

Dorcas answered 16/2, 2014 at 10:20 Comment(3)
Any idea why pm would not terminate after it uninstalled an app?Morena
I am using AVD simulator to run my app with sharedUserId, This tip helped.Hinkley
Shorthand adb shell pm uninstall <Package name>Shum
N
8

In my case, the two app was signed with differents signatures. Using the same signature fix my problem

Numbersnumbfish answered 13/2, 2018 at 16:3 Comment(0)
T
3

The solution for me was to select the "Build > Clean Project" menu option. It took a long time but the application deployed once it was complete.

Tawnyatawsha answered 9/11, 2018 at 21:22 Comment(1)
The issue causing this is that the signing changes are not built, so you have to force the entire APK to rebuild rather than using the cache.Headline
G
2

Although you have accepted answer, I also want talk my situation which I met this error. My project is a Launcher which just happen to use some system grant like, Manifest.xml have two item:

<uses-permission android:name="android.permission.STATUS_BAR" />
 or
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />

and console log out:

Error using StatusBarManagerService - java.lang.SecurityException on android.permission.STATUS_BAR

Lastly, my colleague give me a hint using "platform debug key", I am not sure this will be suitable for you, but for another guys possibility for this kind question. The below picture is my solution: screenshot from project structure you might also notice 'Signing Config' of "Flavors" and "Build Types", you might choose 'Name:' of "Signing".

Genetic answered 16/12, 2016 at 10:16 Comment(1)
I had similar issue and it was due to missing Debug key. So got the hint from your answer. thanksSecessionist
D
1

Simply delete the existing application from mobile and reinstall using run.

Dynel answered 12/4, 2020 at 14:12 Comment(0)
L
1

my issue was having a second instance of the app installed via Samsung Secure Folder! One I uninstalled it there too, my issue went away.

Lolita answered 4/11, 2021 at 7:2 Comment(0)
S
0

In my case, I had two build variants (one specific for a device, and one general).

I was running the device-specific build on an emulator when this error showed up.

Sottish answered 16/5, 2016 at 13:43 Comment(0)
S
0

I did a slightly different approach.

My work involves using a modified Android OS along with a modified adb tool. The app (app1) I am working on "shares a user" with another app (app2) by another team. In order for me to get the Android Studio debugger to work, I had to follow these steps in order:

  1. use the Build (from Android Studio Menu) -> Generate Signed APK
  2. build a debug version of apk (app1) with the key store information used by (app1 and app2)
  3. use adb to uninstall the previous apk
  4. use adb to install the signed debug-apk
  5. use adb to launch the app in debug mode
  6. connect the Android Studio debugger to the app
Scanlan answered 2/8, 2017 at 16:38 Comment(0)
M
0

I have encountered the same problem. I tried out everything, but unfortunately, nothing works for me. As it's a testing device no hesitated to do a factory reset. Oops. sucks didn't work either. Invalidate Cache/ Restart did the trick eventually. Looks like it's an Android Studio 3.5 bug.

Thanks.

Maynor answered 22/2, 2020 at 16:52 Comment(0)
M
0

I was using Emulator and the solution for me was to select the "AVD Manager" and Wipe all data from my Emulator device. After that application was installed.

Megalomania answered 5/3, 2020 at 17:27 Comment(1)
Just removing the android:sharedUserId=... row from the AndroidManifest.xml did the trick.Lysine

© 2022 - 2024 — McMap. All rights reserved.