I am trying to uninstall an old version of my app, and reinstall the new version via ADB on a Lollipop Android device. These are my current steps:
adb uninstall com.company.mypackagename
adb install app-release.apk
adb shell pm list packages
The original uninstall of my old app was successful and the app disappeared from the Android 5.5 device.
The new attempt to install the upgraded app returns:
adb install app-release.apk
Performing Push Install
app-release.apk: 1 file pushed, 0 skipped. 10.7 MB/s (822124 bytes in 0.073s)
pkg: /data/local/tmp/app-release.apk
Success
but when I run a list of the packages, my new APK package is not there.
adb shell pm list packages
When I try to run it anyway:
adb shell am start -n "com.company.mypackagename/com.company.mypackagename.MainActivity"
I get:
Error: Activity class {com.company.mypackagename/com.company.mypackagename.MainActivity} does not exist.
So obviously it is not installing correctly, as it is not showing in packages and unable to run - even though it shows Success. What is the best way to troubleshoot this? Any help appreciated!
I finally found the issue!!!
I'm posting here because I spent way too much time trying to figure this out, since it wasn't giving me any error messages.
I was able to get a copy of the original APK from the deployment team and analyze their AndroidManifest.xml, and saw that the original APK package name was all lowercase: "com.company.mypackagename" but the one I was building was actually using Camel-Case "com.company.myPackageName". When I tried to install it, ADB should have given an error similar to: "Application ID Does not Match", but instead it just repeatedly gave me a response of: "Success".
Hopefully this saves someone else some time!
Related
Help please
I wanted to update a game that I was playing, but it was a modded apk. I deleted the one I had and went to download the updated modded apk but it wouldn't let me because it said "app not installed as package conflicts with an existing package". At this point I'm confused because the game is nowhere in my files like it's not there AT. ALL. so by this point I'm like let me try to download it from the play store and when I went to download it from there play store said "You cannot install this app because another user has already installed an incompatible version on this device". I don't know what to do anymore I've tried the adb command thing and it fixed nothing.
Edit: The fist time I used adb I used the code adb shell and then did $ pm uninstall -k --user 0 app.package it gave me the error "failure [not installed for 0]. by this time I had already uninstalled it but play store still said it was on my phone. Then I dug around some more and found out that the "-k" meant to keep the data and whatnot so I went back and re downloaded the app on my phone using adb and then deleted using adb, tried the play store it still had the same error message. I went back to the command prompt and typed adb shell pm uninstall --user 0 app.package and it showed "failure [not installed for 0].
Try dumpsys user or am get-current-user ...and then use the correct ID of the user, instead of 0.
PS: The personal and the work profile do have different user ID (this alone may cause confusion). Or try listing user-installed packages pm list packages -u -3?
background:
1. I have installed the APK with the 1.1.30 version built by flutter.
2. I want to install it back to 1.1.29
3. I uninstall the 1.1.30 app.
4. I install the 1.1.29 package, and it will throw the error package appears to be invalid.
5. I try to use ADB to install it, but the error will change to INSTALL_FAILED_VERSION_DOWNGRADE: Package Verification Result
6. no idea why the app built by flutter will cause this issue, even if I uninstall the app fully.
7. the solution is using ADB install -r -d [path_to_debug_apk] to replace and downgrade the app.
can someone explain why this happened? is the app can not uninstall completely? thanks.
also refer to this link: Error: ADB exited with exit code 1 Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
it seems the same to me who still can not install it even though the app was removed.
some information added:
I used adb shell cmd package list packages, can not find my app but the command with adb shell dumpsys package[pageckage name] can find my app.
so weird
First, I have already uninstalled this app from my Huawei tablet device.
Now, I want to reinstall the APK with same package name using adb command line from my Mac.
./adb install ~/myapp.apk
I got this error:
Performing Streamed Install
adb: failed to install myapp.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.example.myapp signatures do not match previously installed version; ignoring!]
From browsing around, I learn that perhaps the app did not uninstalled correctly. So I use adb shell.
$./adb shell
Device:/$ pm uninstall com.example.myapp
Failure [DELETE_FAILED_INTERNAL_ERROR]
Device:/$ pm uninstall --user 0 com.example.myapp
Failure [not installed for 0]
Device:/$ pm list package | grep myapp
(empty result)
Device:/$ pm list package | grep google
package:com.google.android.inputmethod.latin // which means list package & grep working fine
Device:/$ pm list package -u | grep myapp
package:com.example.myapp // which means pm already acknowledge myapp is uninstalled
So at this moment, I'm at loss. Even adb shell cannot see the app package. But still, when I try to install the APK, I get the error above. How can I resolve this?
For people still facing this issue, yes this issue is still unresolvable to this date. At least I have found out why the issue happens, which is apparently because when I remove an app, Huawei asks whether I would also want to remove the app's data or not. I answer "no". And once you answer "no", you'll never be able to reinstall that app on that device ever again, because of the residue of the app data on your device. And I have tried my best to remove any residue by any means, I still cannot reinstall the app.
Only one cure works: reset factory settings. I did this and now I can reinstall the app. Of course, that means the data will be lost. But at least there's a Huawei backup app, so there's that.
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 trying to install an apk (downloaded from one site) in ICS emulator through adb shell but its giving following error:
Failure [INSTALL_FAILED_UID_CHANGED]
What could be the issue?
Simply rm -r the data directory in question. If you were installing and got this error, you'd simply run "rm -r /data/data/com.app.class" from an ADB shell. If you want to try preserving the data, you could find the proper UID and then "chown -R UID:UID /data/data/com.app.class".
In Android, the part of the source code that handles installing apps is PackageManagerService. Since the Android source is public, it's easy to see where Android will throw a INSTALL_FAILED_UID_CHANGED error. If the following is true: the package you are installing already has a data directory AND the permissions on that data directory are different than the UID assigned to this package, you'll get that error.
Uninstall the previous version of the app from the emulator first, then try again. You can do this by visiting System Settings > Applications > Manage Applications and selecting the app.
If the app still fails to install, then start the emulator with the Wipe user data option selected.
Open command prompt and write below code in it:
adb devices
This will list down the number of devices attached or are active.Copy your apk in your System folder
adb -s DEVICE_NAME install YOUR_APK_NAME
through this you will be able to install your particular apk on the device by giving device name in above line.