Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shared User ID and Signing with Android

Tags:

android

I am trying to have 2 Android applications which can access each other's data. I have a two test applications which I am experimenting with. I set the 'Shared user id' for each to 'com.gabysoft.sharedfiles'. However, when I sign the first app and try and install it, I get the error:

11-05 16:50:33.422: ERROR/PackageManager(61): Package com.gabysoft.sharedfiles1 has no 
signatures that match those in shared user com.gabysoft.sharedfiles; ignoring!

Clearly, I am not signing it correctly (I am using Eclipse's "Export signed application package" function). How do I properly sign the .apk file so that I don't have this problem?

Thanks

like image 574
John Gaby Avatar asked Dec 10 '22 13:12

John Gaby


1 Answers

If you set a sharedUserId, and install the app onto your device from Eclipse (which, by default during development, signs it with the debug key), you create a permanent bond between that signing key and sharedUserId. /data/system/packages.xml, as well as the Dalvik cache, hold info on shared user id's associated with apps. I, however, have not found a way to consistently wipe that old debug release leftovers on my GN, even after following the related thread on XDA.

So, if you really need to use the sharedUserId, you could append any fixed string to the sharedUserId just to change it in the AnroidManifest.xml only when developing and using the debug key. You should, however, have a check that you never check it into the code repository or release it, because once you set the sharedUserId and release the app, it's done. You must never change it, otherwise your app will loose access to its own files and will become unusable.

Watch out, sharedUserId is tricky. See this blog post for possible related issues.

EDIT: I just noticed how old this question is, but I still think someone may find the answer valuable, as I have reached that question myself while Googling.

like image 138
karni Avatar answered Dec 25 '22 21:12

karni