user3880451
user3880451

Reputation: 31

Is there any way to upgrade an Android app by adding android: sharedUserId in the manifest, without uninstalling the app so the data gets persisted

In manifest I put android:sharedUserId="xxxx.xxxx.xxxx" and android:sharedUserLabel="@string/shared_user_label"

<manifest package="com.xxxx.xxxx"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:installLocation="internalOnly"
      android:sharedUserId="xxxx.xxxx.xxxx"
      android:sharedUserLabel="@string/shared_user_label">

In build.gradle I changed versionCode 26 to versionCode 27 and versionName "1.1.14" to versionName "1.1.15"

defaultConfig {
applicationId "xxxx.xxxx.xxxx"
minSdkVersion 15
targetSdkVersion 22
versionCode 27
versionName "1.1.15"}

When I compile and run the app it shows a popup dialog "Application Install failed" with the following message:

Installation failed with message INSTALL_FAILED_UID_CHANGED. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

Is there any way to upgrade the existing application by adding android: sharedUserId without uninstall? If yes, How?

Upvotes: 1

Views: 1122

Answers (1)

Samurai_143
Samurai_143

Reputation: 11

If you want to use android:sharedUserId, Android system will not allow to upgrade app, since UID got changed

alternate option is to use contentProviders to share the data between apps

Upvotes: 1

Related Questions