Android INSTALL_FAILED_UID_CHANGED

前端 未结 26 1137
走了就别回头了
走了就别回头了 2020-11-28 07:37

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 wit

相关标签:
26条回答
  • 2020-11-28 07:54

    For rooted devices:

    Run the below command

    adb rm -rf /data/data/<your.package.name>
    

    For non-rooted device:

    1. Change the ApplicationId of the app. Refer this link to change ApplicationId.
    2. Build and install the app. App will install successfully because it is treated as new app.
    3. Now uninstall this app. Which will clear the data.
    4. Now change the ApplicationId to the previous one.
    5. Build and install. Magic.. It will install.
    0 讨论(0)
  • 2020-11-28 07:54

    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.

    0 讨论(0)
  • 2020-11-28 07:54

    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?

    0 讨论(0)
  • 2020-11-28 07:56

    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.

    0 讨论(0)
  • 2020-11-28 07:56

    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.

    0 讨论(0)
  • 2020-11-28 07:59

    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:

    1. Run adb shell
    2. Run pm uninstall <app name> (i.e. com.example.myapp)
    3. 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".

    0 讨论(0)
提交回复
热议问题