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
For rooted devices:
Run the below command
adb rm -rf /data/data/<your.package.name>
For non-rooted device:
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.
Okay, so for my LG NEXUS 4 rooted here is the solution: (
and
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?
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.
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 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:
adb shell
pm uninstall <app name>
(i.e. com.example.myapp)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".