In Android phone, by default, there are two users, one is me, the other one is Guest.
I am doing Android app development. I install the debug mode apk by run command :
adb install myapp.apk
But when I uninstall it from :
Settings -> Apps -> (click into the app) Uninstall
the app is uninstalled but the app icon is still showing there & there is a text says it is uninstalled, if I adb install myapp.apk again now, the installation fails.
To get rid of this, I have to always switch to "Guest" user, and uninstall also from there. It is very annoying. Why adb install myapp.apk installs the APK on both users?
How can I only install the app in current user with adb so that when I uninstall it from settings it could be uninstalled completely without bothering me to switch to Guest user to uninstall again?
adb install -rf apk
This helps you in doing forceful re-installation
Related
My native settings app crushing when I start it, how to install the different settings application or from another shell/environment?
You mean same package name but not same app currently installed device?
I think you should install using adb with some option.
Please try,
adb install -r -d [your app].apk
I'm trying to make sure a particular test device (Pixel 3) will install a new version of an apk but whatever I do it seems to be running an older version.
Tried so far:
adb uninstall <app_name>
adb install -r <app_name>
Manually clearing it's cached data and uninstalling on device
Restarting device between uninstall and reinstalls
No matter what I do the app appears to be the previously installed version. I'd think I was crazy but I've had issues with the auto-backup on Pixel devices hiding logs, restoring preferences & cache data before.
Any suggestions on how I can 100% force a purge of all the data to do with this apk so I'm guaranteed a fresh install?
You have to set a property in your manifest allowBackup=false and make sure your instant run is disabled.
For manually uninstalling the app, try:
adb shell pm uninstall <app_package_name>
If the app is installed, this will say success. If the app is not installed, you usually get an error message.
For installing the app, try with out the "-r" parameter:
adb install <app_package_name>
Note that installing with the "-r" parameter is for an app update, and thus if you already have the app installed, and do not have a newer app build version (as declared in build.gradle) then it will keep the current version. With just adb install you will see a message if the app already exists.
To check if the app is installed, you can look for the app package name on the device with:
adb shell pm list packages -f
If you are installing via AndroidStudio, try turning off instant run options by going to Preference and searching for instant run, and having enabled unchecked. Cleaning build, maybe even an invalidate and re-sync caches and try again.
I cannot uninstall debug APK manually which I installed directly from Android studio, and also I can't install the debug APK manually in the phone. I have the released version of the same app installed from play store on my phone.
it may be, you have multiple users on your device, just go settings->Apps->Select your app->open the context menu on the right and type uninstall for all users.
--Edit:
from next time user command adb install -r --user 0 <apk file path>
And when you uninstall with adb uninstall <pkg name>, it only uninstalls from user 0
so, apk is still installed for other users. And you have to go to settings->Apps->Select your app->open the context menu on the right and type uninstall for all users
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.
I am using the these instructions to build a signed, aligned version of my app.
However, when I install the signed version of my app adb install bin/Foo-release.apk, the app does not show up in the apps list on my phone.
On the other hand, when I install the debug version, the app does appear on my phone.
Note that the output of adb install is the same in both cases.
Is there something obvious that I am missing?
It appears that I was not uninstalling the debug version properly before trying to install the release version. I was using the command adb shell pm uninstall -k my.package.name, which makes the Application Icon disappear but apparently does not fully remove it.
Instead I needed to use adb uninstall my.package.name.