I have checked all the solutions, comments and answers of all other questions in StackOverflow.
I have been running, compiling and debugging my app for months. But suddenly it started to appear this message in my Eclipse when using my Nexus to play with it.
MOBILE:
I have no root !!! (It's a Nexus, and I have no root, and all the answers in other Stackoverflow's questions need root to be executed)
The application is uninstalled, there's no trace of it in "Applications"
Since I don't have root access, I can not access to /data/data folder, or /data/local, or /data
I do know problem would be solved resetting the phone to factory settings, but, sincerely, I can not.
ECLIPSE:
I have cleaned the project many times, restart Eclipse and even update it
I can not change the name of the project (as one solution suggests), since it's a long time project and I can not change it
Console says:
Installation error: INSTALL_FAILED_UID_CHANGED
Please check logcat output for more details.
Launch canceled!
Logcat says:
01-05 12:18:19.265: W/ActivityManager(761): No content provider found for permission revoke: file:///data/local/tmp/MyApp.apk
01-05 12:18:20.855: W/PackageManager(761): Package couldn't be installed in /data/app/com.myapp-1.apk
I can install, uninstall other APK/applications with no problems at all. So it's not about permissions in /data folder/subfolders
CONSOLE:
If I try to uninstall (with -d or any other parameter) the app it says: "Failure" (because adb does not find the app in the phone)
So, I'm not debugging with virtual machine / emulator. I have a Nexus no-rooted with no trace of the application, and I can not build the app from Eclipse to the device.
Thank you
I had the same issue in my non-rooted Nexus 5. I managed to solve it without root access nor Factory reset.
For this device, I managed to solve it by going to Settings -> Storage -> Misc and try to delete any files related to the faulty app (in my case, an .apk that was pushed from Android Studio and a .db file). I also clicked on Cached data to wipe the cache for all apps.
I don't know exactly which of the two things triggered the solution. You probably want to try to delete some files in Misc before wiping the cached data, since it seems less of an overkill.
It seems to be that there were some remaining files from a previous installation which weren't wiped with the uninstall (probably an issue in the Android installation system). These files aren't accessible without root access, since they are under the /data/local/ folder. Apparently the Storage tools for the Nexus 5 have permission to delete files under that folder.
I don't know whether other devices have a similar set of storage tools.
Downloading app from play store will resolve the issue.
To continue development on the app, uninstall the currently installed app and just launch the app from eclipse.
It works fine.
This may seem odd, but my pointy-haired boss just had this issue and tried everything we could think of. Just would NOT install due to the INSTALL_FAILED_UID_CHANGED error.
He uninstalled some other apps (games) and suddenly it would install. Maybe it is an issue of disk space on internal card? Dunno, but worth a try when someone else hits it.
First time this happened I tried installing from eclipse, from command line etc....
Everything failed so I did a factory reset which then worked.
24 hours later it happened again.
Not wanting to do another factory reset, I tried all the same things again to no avail.
Lastly I tried downloading our current app from the appstore, which miraculously worked.
I then used adb to reinstall.
So if you have a version of your app in the app store, try installing that to get something on your phone, then do a reinstall "adb -d install -r $PACKAGE.apk
Hope this helps someone.
This (or some other magic) helped me:
adb shell pm clear MY_PACKAGE_NAME
I can solve this like below without rooting on my Nexus 5.
Push your app to /sdcard/
adb push test.apk /sdcard/
adb shell
adb shell pm install -l /sdcard/test.apk
-l option means - pm install: installs a package to the system. Options:
-l: install the package with FORWARD_LOCK.
Here are some other things to check/try that are safe to do:
Make sure your package name is 100% unique and not colliding with
another app. You could temporarily change it to test.
Try powering your phone off and then back on to clear
data caches.
Try a soft reset for your device (which might be the
same as powering off/on).
Try deleting Cached Data under Settings -> Storage, this will clear all cached App data at once, but it does the job (in my case)
This is because of if you have install the app with same package name. So try to remove that one.
I could only fix this by rooting. I know you don't want to do that, but it worked for me. I downloaded Titanium Backup then found my uninstalled app crossed out in the list on Titanium Backup. I couldn't get rid of that crossed out one until I went to Batch Actions then Remove orphan data. That allowed me to re-install my app and it worked well.
This worked for me:
adb install -l -r <'apk_name'>.apk
-l = forward lock
-r = reinstall
I had this exact same problem. What finally worked for me was to change the applicationId (your package name) in build.gradle to something different, then rebuild the project, and voilĂ , successful deployment.
What led to this situation was that I'd copied an existing Android Studio project into a new one, and was working off of that new one. The thing is, I'd never deployed the original apk on my device before, and was only trying to deploy the new copy of the app.
I was using a device that was just for testing, so I just reset the whole device. It worked for me anywho.
This solution worked for me:
Put your APK to the device's storage/sd card
adb shell pm install -l -r "/sdcard/<apk_filename>.apk"
-l = forward lock
-r = reinstall
For no root Device you need you need to delete the app from the app list in the device:
go to "settings"
go to "storage"
on third tab "downloaded apps" locate your app
you can delete it from there
Works for me!
In my case changing the package name of the GCM signature worked. since it uninstalls the complete package.
For more detailed explination click here
<permission
android:name="com.androidcodelab.sampleproject.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.androidcodelab.sampleproject.permission.C2D_MESSAGE"/>
Package name of the project changed to :
<permission
android:name="com.androidcodelab.xyz.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.androidcodelab.xyz.permission.C2D_MESSAGE"/>
and then I reverted back to the actual package name
For android studio go to File-> Project Structure -> app -> Flavors and your right side you will see Application Id field just change Application Id and you are ready to go... :)
Go to Run/debug configurations.
Under Android App delete "app".
Then add another configuration under module: app
For me the only way was to root the phone and clear /data/data/ directory. Here are the steps:
1. Open web browser on mobile device
2. Open website: https://towelroot.com/
3. Click on lambda sign to download Towerl Root and install it afterwards
4. Open Towel root app and click on button "make it rain". If it says: "device not compatible" google other wait to root the device.
5. Download SuperSU app from Play Store
6. Download Terminal Emulator app from Play Store
7. Run Terminal Emulator
8. Type following command in terminal emulator:
su
9. Allow superuser access for terminal emulator
10.Type following command in terminal emulator, substitute 'package_name' with your app's package name:
rm -r /data/data/package_name
I tried all above and NADA!
the ONLY way it works for me (NON ROOTED DEVICE) was:
1.- Change on Project structure [Ctrl+Alt+Shift+S]->Flavors: the Application Id, for example:
'com.example.something' to 'com.example.somethingxx'.
(which is the same as changing on the build.gradle file)
2.- Refactor package name of the project to the SAME NEW NAME you used on Application Id: 'com.example.somethingxx'
This will ensure you are installing a new App on the device... let me know!
Related
I'm running AICP on my Nexus 5, with android 5.1.1. I've been trying to install a few APKs I've found online, and I always get the same error which is Failure [INSTALL_FAILED_CONTAINER_ERROR].
I see other people online who have been able to install them, so I'm unsure why mine is failing. Although it only seems to happen with some APK files and not others. Is there anyway I can figure out more on why it would fail to install on my device?
If it helps I've tried running the APK files on phone and through ADB and same problem.
I've tried running my own APK files (signed) and they work perfect.
Unknown sources is definitely allowed. Also free space is about 6GB at the moment, so don't think thats the issue.
This usually happens when android:installLocation is set to "preferExternal" and your AVD has a too small SD card. You have to increase the size of the SD card or change installLocation to auto in AndroidManifest.xml as below, but I think you can't that.
android:installLocation="preferExternal"
to
android:installLocation="auto"
Also please have a look at this
I finally found a work around for the installation problem! Due to the help from varunkr, it does seem to be a storage problem from what I can tell. I was able to get it working though by changing the default install location of my device. Basically I had to do the following:
Connect my device to my computer with adb, rooted etc
I started root by typing adb root
Changed the default install location to internal by going adb shell pm set-install-location 1 in console.
Typed adb install applicationName.apk and everything work perfectly!!
I'm not sure if you want to place the default application installation back afterwards by placing it back to auto as follows: adb shell pm set-install-location 0
But by doing this I was able to get the application to install, and am happy I can get around it now.
I've built a silly app to share among a few friends. No need to put it up on the app-store.
I built the first apk (signed), uploaded it to a web-server and all worked well.
A small issue arose, I fixed it, re-built, signed with the same keystore and uploaded it again. It now seems that I am unable to install from the new apk. The debugger tells me:
signatures do not match the previously installed version
So I uninstalled the old version by opening the app drawer and dragging it onto the "uninstall" button. When opening "Settings -> Apps", I don't see it anywhere anymore. I don't see any traces of the app on my device.
Yet I still get the above error message.
Is it possible some information still lingers on the device somewhere? Is there any way I can verify that?
Yes It is possible if somehow your old application is not removed 100% or its data is not removed.
Try:
adb uninstall "com.yourapp.yourapp"
If you don't know exactly what to put as replacement for "com.yourapp.yourapp", then you just open Android studio, Run your app while it is connected to a device and then look at Debug window.
It says:
Waiting for device.
Target device: samsung-sm_t531-xxxxxxxxx
Uploading file
local path: C:\Users\myapp\app\build\outputs\apk\myapp.apk
remote path: /data/local/tmp/com.myapp.myapp
Installing com.myapp.myapp
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.myapp.myapp"
pkg: /data/local/tmp/com.myapp.myapp
Success
com.myapp.myapp in this case is the name of the package you must use to uninstall.
I had the same issue and the adb uninstall solution did not work for me.
What worked was
On your device go to to Settings->Apps
Select your app, and in the menu select "Uninstall for all users"
Even if I had previously uninstalled the app it was still in the list there.
To me, if the app is meant to be distributed, the adb solution is a no-go: you can't ask one's friend to have the android sdk installed on their machine !
The way to go here is to edit the AndroidManifest.xml and to increment the android:versionCodeattribute in the <manifest>tag (which is the root element).
This would update your installed application
If you are seeing this while conducting connected tests, make sure to include .test when uninstalling via adb because uninstalling via app -> settings does not get rid of the test package
adb uninstall your.broken.package.test
if you just uninstall via
adb uninstall your.broken.package
your test package will still be there. This was only something i noticed while using the gradle command line, haven't come across this problem within android studio
Uninstall the old app from your phone or emulator and try to run again.
I got that error while trying to install release while signing it's certificate.
fixed with the :app Gradle task uninstallRelease and then installRelease again
If you are going in install the same app with a different signature, you may want to uninstall but keep the app's data.
adb -d shell pm uninstall -k <packageName>
adb -d install -r -t -d app.apk
For Unity users who come to this question, the best answer is indeed the one above by #Ehsan
adb uninstall "com.yourapp.yourapp"
I had already installed a previous version on my Android device then selected Development Build in Unity > Build Settings which caused the APK to use a different signature. If you install through the Android GUI it doesn't actually remove everything so you have to use ADB.
I had face same problem With POCO Mobile and Moto G30 Mobile while developing application in flutter
My Solution is:
I have open android project which automatically create in your project, in android studio and run project in connected device. It will automatically ask to uninstall old app with same package name and different signature. After click ok button it will install app.
Im trying to run an application on my GS5 from android studio and Im getting this:
Waiting for device.
Target device: samsung-sm_g900v-f3af9744
Uploading file
local path: D:\Android\Projects\TestProject\build\outputs\apk\TestProject-debug.apk
remote path: /data/local/tmp/com.brian.testproject
Installing com.datascan.mobilescripts
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.brian.testproject"
Aborted
It seems to be copying the file to the device, I can see it in the /data/local/tmp directory. Its just failing at the "pm install" stage.
On the phone I turned on USB Debugging and authorized the computer. Here is what I get when I run ADB devices:
D:\Android\sdk\platform-tools>adb devices
List of devices attached
f3af9744 device
So that seems to be correct. Im not really sure what the problem is. Google search on the problem didnt give me any relevant results.
Does anyone know how to get more information beyond "Aborted"? Any help is appreciated, Thanks!
EDIT:
As suggested by #AlexP. I ran "adb logcat -d -s PackageManager:*", this was the result:
D:\Android\sdk\platform-tools>adb logcat -d -s PackageManager:*
--------- beginning of main
--------- beginning of system
Not much help, but I did decide to watch the logcat as the pm install was being run and I found this error entry:
Tag=appproc | Text= ERROR: Could not find class 'com.android.commands.pm.Pm'
Tag=art | Text= art.runtime/thread.cc:1105] No pending exeption expected: java.lang.ClassNotFoundException: Didn't find class "com.android.commands.pm.Pm" on path: DexPathList[[zip file "/system/framework/pm.jar"],nativeLibraryDirectories=]/vendor/lib, /system/lib]]
Followed by a whole slew of art error entries.
So it seems as though my phone is missing something, maybe?
The reason that Android Studio fails on Galaxy S5 is because the adbd (ADB service on the phone not your PC), on rooted version of this phone does not run as root, which is a security measure. You can verify this by manually trying to execute the Android Studio apk and execute commands on the device and finding out that they are failing to execute, but retrying them using "su ..." and see that the app installs and starts on the device. There are three options to resolve this and unblock Android Studio:
Options:
Flash a ROM that includes the modification - not desired as from my understanding you would like to stay on the stock image; also a good security measure not to have adbd running as root all the time. Older roms fall in this category as well, but then you are missing Stock Rom updates and security patches.
Create a custom boot.img and flash it to your phone - this is basically a custom kernel and not desired for a similar reasons than above option 1.
Restart adbd on your device with root privileges when doing app development - preferred and achievable fairly easy thru various methods including:
Preferred Solution:
a. Restart adbd with root privileges (insecure mode) by killing the service on the phone and using a terminal app or so to restart it using "su". After you are done with your app development, restart your phone and adbd will be back in secure mode, restoring the security measures.
b. Use Chainfire's ADB insecure app, which is free on XDA (download/link below) or pay for it on Google Play to support his work. You can toggle the mode in the app. In the app, you also have an option to auto re-enable the insecure mode on reboots.
References:
https://android.stackexchange.com/questions/5884/is-there-a-way-for-me-to-run-adb-shell-as-root-without-typing-in-su
http://forum.xda-developers.com/showthread.php?t=1687590 (includes free download link)
https://play.google.com/store/apps/details?id=eu.chainfire.adbd (for supporting Chainfire's work)
Possible Solutions :
1. Check if your app had left any datas :
First if the app is already installed, then clean cache data and uninstall it
Under "System Settings" then "Application Manager"
http://i.stack.imgur.com/b3oys.jpg
Then
Force uninstall by running & adb shell pm uninstall com.brian.testproject
Check "/data/data/com.brian.testproject/" and delete it
Remove any entries of your package on /data/system/packages.xml
Remove any entries of your package on /data/system/packages.list
Also you could install SDMaiD and clean your device, especially with "CorpseFinder" and "AppCleaner"
2. Try to install the app manually and debug the result :
In your case you have an issue with pm over android studio... install it manually to have a more detailed message over command line
$ adb push D:\Android\..\TestProject-debug.apk /sdcard/myapp.apk
$ adb shell pm install /sdcard/myapp.apk
3. Check Android Studio and your app sources
Change the targeted api level :
Right click on your app dir + Open Module Settings + app + check sdk version + change target and minimum under "Flavor"
Sync gradle button
Rebuild project
https://www.youtube.com/watch?v=v4b7C6Q-9dI
Update your android studio if you don't have the last release
If your app use libraries, you have to recompile them.
4. Check System Settings :
Check BOOTCLASSPATH of your init.rc. BOOTCLASSPATH must include /system/framework/ext.jar and /system/framework/framework.jar and so on.
Check DEXPREOPT_BOOT_JARS of build/core/dex_preopt.mk. DEXPREOPT_BOOT_JARS must include ext and framework and so on.
The order of all items on BOOTCLASSPATH must be equal to the order of all items on DEXPREOPT_BOOT_JARS.
5. Try pm command directly on the device :
if pm command does not work try that command with a terminal directly on the phone to see if it's a connection issue between pc and phone
pm install /sdcard/myapp.apk
6. Reinstall your rom once again (just reinstall it) no need to erase.
For anyone having this same issue, unfortunately the only solution that I could find was to downgrade my ROM version (to OA8). Once I did that, adb works perfectly. If anyone finds a better solution I'd be definitely like to know.
Android Studio
step 1: Go to file--> invalidate and restart.
step 2: Clean and rebuild project.
step 3: go to project folder run
gradle clean
step 4: restart phone/Emulator.
Done !!!
I try installing my app for the first time on a Nexus 5.
The android studio then tells me I need to uninstall my app inorder to install it (The app never exsited on the phone) and then asks me to unistall the app, I agree and he tries to unistall but an error occurs:
Waiting for device.
Target device: lge-nexus_5-08a9df88021f8ec8
Uploading file
local path: D:\USER\Desktop\Yoav\AndroidProject\Example\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.example.user.example
Installing com.example.user.example
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.user.example"
pkg: /data/local/tmp/com.example.user.example
Failure [INSTALL_FAILED_DEXOPT]
At this part the studio asks me to uninstall after pressing ok:
DEVICE SHELL COMMAND: pm uninstall com.example.user.example
Unknown failure
I think it's because the app does not exsit on the phone, but if the app does not exsit why does it even want me to delete it?
It might be because of the package name. Check weather is there any app with the same package name that you created before. com.example is not a good practice to use for you practice projects even.
I may be not right but from the information provided this is what I can say.
It happenes because the .apk you built and are trying to install is missing the classes.dex file. This can happen for various reasons but most of the time (for me) the build process gets stuck somehow.
Open Task Manager and kill all following processes:
cmd.exe
conhost.exe
find_java.exe
Then clean and build your project.
Also make sure you use latest Build tools (now 21.1.1).
I had the same problem. I finally had to reboot the device to solve it.
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.
Follow these steps to fix the INSTALL_FAILED_SHARED_USER_INCOMPATIBLE error:
Remove the existing application (if it was already installed)
Remove the sharedUserId from AndroidManifest.xml
Rebuild the application
Reenter the sharedUserId to AndroidManifest.xml
Rebuild the application (one more time)
This means something about your app was not correctly uninstalled. This steps help to force uninstall from internal commands:
Connect your phone to PC with usb
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
In my case, the two app was signed with differents signatures. Using the same signature fix my problem
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.
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".
Simply delete the existing application from mobile and reinstall using run.
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.
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.
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:
use the Build (from Android Studio Menu) -> Generate Signed APK
build a debug version of apk (app1) with the key store information used by (app1 and app2)
use adb to uninstall the previous apk
use adb to install the signed debug-apk
use adb to launch the app in debug mode
connect the Android Studio debugger to the app
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.
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.