Question about -k option on ADB uninstall command - Android Q&A, Help & Troubleshooting

Every example that I've seen of the ADB uninstall command has included the -k option to keep the apps data and cache directories.
Generally before I get around to uninstalling an app I mess around with various app settings in an attempt to get the app to work the way I want. I suspect that by saving the apps data and cache directories the app will retain the state of settings that existed prior to being uninstalled.
The problem is that my preference is for the app to be restored without any modifications I may have previously made and therefore I do NOT want to use the -k option when I uninstall an app. My hope is that the reinstalled app will be in its initial factory setup.
I have reinstalled a couple of apps that I uninstalled without using the -k option and I have noticed no ill effects but I worry that there may be some issue with doing it this way.
So does anyone know whether or not my assumption that if an app that was uninstalled without the -k option is reinstalled it will be restored in its default factory configuration is correct? If not then what does happen when an app uninstalled without the -k option is reinstalled?

Mumblefratz said:
...
So does anyone know whether or not my assumption that if an app that was uninstalled without the -k option is reinstalled it will be restored in its default factory configuration is correct? If not then what does happen when an app uninstalled without the -k option is reinstalled?
Click to expand...
Click to collapse
Your assumption is correct.

xXx yYy said:
Your assumption is correct.
Click to expand...
Click to collapse
Thanks. That's what I was hoping.

Related

Using ADB & usb debugging to uninstall system app - how to revert?

Hi guys
im on a mate 10 pro, non rooted, uninstalling some non-essential system apps (not really uninstalling as the data files and apk are still there just unavailable)
i have accidentally deleted the thememanager for my phone using:
pm uninstall -k --user 0 com.huawei.android.thememanager
the thememanager oat and apk is still located at /system/app/HwThemeManager
if i create a new user the app is still there
is there any way i can restore its functionality on the original user?

can't unistall system apps

Hello. I've just updated to miui 9.5 global stable. I have also flashed twrp and rooted with superuser. The problem is that I can't unistall system apps with system app remover pro, althouth that with previous miui didn't have this problem. When I try to unistall any system app it says ''failed umistall''. I have also tried some other apps as root unistaller, but the problem remains. Please any help.
You could try adb, but be careful. You need to know what to uninstall and what to not uninstall. Download platform-tools, use a command prompt (cmd) to access the platform-tools folder, connect your phone via USB debugging, enter adb devices into the command prompt, and list all the packages with adb shell cmd pm list packages
All the apps on your phone will be listed as their package names. You can uninstall (or disable) these packages by entering pm uninstall -k --user 0 <name of package>
You can disable packages (and renable them if something goes wrong) with command pm disable <name of package>
Uninstalling works whether you're rooted or not. I think disable only works if you're rooted, but IDK.
https://www.reddit.com/r/Android/comments/6ftg72/want_to_completely_disableuninstall_those_pesky/
The problem with this method is, you need to know exactly what to uninstall or your ROM will get screwed up. Like UI will stop working. In that case, you have to factory reset and start again. So backup all your files before attempting this.
I'd use Titanium Backup that way you can initially backup the app before uninstalling and delete later once you're 100% sure you no longer need it (although save the backup to a Micro SD or PC anyway).
If you're going to use ADB then the PC Inspector app will help identify the correct app to uninstall.
Edit: Are you 100% sure you've got full root? Have you checked with something like Root Checker (joeykrim)?
Big Elf said:
Edit: Are you 100% sure you've got full root? Have you checked with something like Root Checker (joeykrim)?
Click to expand...
Click to collapse
Yes I have checked it with Root Checker.

Getting DeadObjectException on uninstalling any app

On a fairly old non-rooted Galaxy Tab A-tablet I wanted to uninstall all the Samsung and Microsoft apps and most of the Google packages to make it faster. Using adb shell pm uninstall -k user 0 I uninstalled 106 packages but after "com.sec.android.app.music" I suddenly can't uninstall packages anymore. Instead I get a DeadObjectException and the tablet reboots:
Code:
$ adb shell pm uninstall -k user 0 flipboard.boxer.app
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:628)
at android.os.BinderProxy.shellCommand(Binder.java:675)
at com.android.commands.pm.Pm.runShellCommand(Pm.java:299)
at com.android.commands.pm.Pm.runUninstall(Pm.java:674)
at com.android.commands.pm.Pm.run(Pm.java:170)
at com.android.commands.pm.Pm.main(Pm.java:103)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:315)
It looks to me like pm needs something that isn't there, so I might have uninstalled something that it needs. My question is, how do I find out what it was, and, assuming is wasn't the Samsung music app, why did it function correctly until after I installed that?
Thanks for any help!
I have reset the tablet to factory settings and all the apps are there again, but even now I get the same error when attempting to uninstall any of them.
I'll bump this up, since I just ran into the same issue. At least, for me, I could continue to remove apps, including the one where I made a mistake on (added a space in the middle of the package name). Now, my settings app and another communications app won't work (messages and other apps are still good).
My command prompt text, just in case it'll help fix this issue. I don't know which app was the cause.
Code:
heroqltetmo:/ $ pm uninstall -k --user 0 com. samsung.android.ststub
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:763)
at android.os.BinderProxy.shellCommand(Binder.java:817)
at com.android.commands.pm.Pm.runShellCommand(Pm.java:334)
at com.android.commands.pm.Pm.runUninstall(Pm.java:726)
at com.android.commands.pm.Pm.run(Pm.java:174)
at com.android.commands.pm.Pm.main(Pm.java:107)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:287)
255|heroqltetmo:/ $ pm uninstall -k --user 0 com.samsung.android.ststub
Success
I'll keep checking to see exactly which apps I shouldn't have removed, but there were a few accidentals.
EDIT: Found a way to find the list of uninstalled apps from running the
Code:
pm list
command twice, one with and without a -u to get 2 lists of packages, all before and after the operation. I then used Excel to find and mark any duplicates. Then I took the remaining list and re-installed them (and restarting my device after a few changes). I hit a few issues, with setup wizard failing to work, missing contact names, the Contacts app and a communication app cannot open, settings fails to work, some apps produce sound despite on silent, and not being able to unlock my device (even with a swipe lock). I didn't reset the device, but restart it several times, including booting it to recovery mode.
I'll be uninstalling more apps, setup wizard was an immediate choice, when I could figure this out. In the meantime, I'll be sideloading an app to mute the device.
EDIT 2: No progress, whatsoever, but apps work fine except Settings and LINE (the previously mentioned communications app). LINE is uninstalled (I have it on computer), and apparently (for my default mesaging app), I could see my text messages, but not respond... I might get another device to use (doubting it, as it's the 4th or 5th device I've gone through).
Note: This guide helped me uninstall apps. It was something I spent a while trying to figure out, but finally found something that works (until there's a typo).
I didn't bother with resetting the device, but at least I made backups since I was prepared for a reset to flash custom ROM or just to get root. Well, I did a reset and the device is fixed now. I'll continue to uninstall apps as before.
---------- Post added at 10:11 AM ---------- Previous post was at 09:41 AM ----------
I didn't bother with resetting the device, but at least I made backups since I was prepared for a reset to flash custom ROM or just to get root. Well, I did a reset and the device is fixed now. I'll continue to uninstall apps as before.
EDIT: Uninstalling apps was smooth (at least i have a list now), but I hit the settings app keeps stopping issue after opening an app. Maybe because there's something missing...?

How do i uninstall app market and game center from realme 6 4gb variant(without root)

I have tried uninstalling using adb, it was successful for other apps but these two apps do not seem to want to go away.
My device is on the Latest version of the global release of realme UI ,and powershell is throwing an error 'delete_failed_internal_error'
this is the command that I used - 'pm uninstall -k --user0 com.heytap.market'. I was able to successfully delete the browser and similar apps using this command. I tried searching for device administrator but but both of those apps are not device admin either.
PLEASE HELP.
I need to try out your method. By the way do you remember which stock apps you had removed without a system error?
ap6709 said:
I need to try out your method. By the way do you remember which stock apps you had removed without a system error?
Click to expand...
Click to collapse
Game space, browser, google duo, play movies, theme store and weather
Try app market and game center and do tell what happens.
I am always getting this message "Failure [DELETE_FAILED_INTERNAL_ERROR]" and hence I decided to wait for root access.
Ebebeeh said:
I have tried uninstalling using adb, it was successful for other apps but these two apps do not seem to want to go away.
My device is on the Latest version of the global release of realme UI ,and powershell is throwing an error 'delete_failed_internal_error'
this is the command that I used - 'pm uninstall -k --user0 com.heytap.market'. I was able to successfully delete the browser and similar apps using this command. I tried searching for device administrator but but both of those apps are not device admin either.
PLEASE HELP.
Click to expand...
Click to collapse
Can u please describe the procedure how u uninstalled the system apps because i also want to remove them.Sorry this reply is not related to your solution.
Game center cannot be deleted. I tried too on 6 pro. Doesn't work. That and Oroaming.
You can try using this command:
pm disable-user --user 0 com.heytap.market
will not work
Sakai121 said:
You can try using this command:
pm disable-user --user 0 com.heytap.market
Click to expand...
Click to collapse
it won't work
PS C:\adb> .\adb shell pm disable-user --user 0 com.heytap.market
Package com.heytap.market new state: default
No tap market on europea version
Using ADB to remove some bloatware apps
chinmay kumar said:
Can u please describe the procedure how u uninstalled the system apps because i also want to remove them.Sorry this reply is not related to your solution.
Click to expand...
Click to collapse
@chinmay kumar you can use adb to remove apps by using adb shell pm uninstall -k --user 0 <package-name>. This command will likely remove all packages that you want to remove. It does give error in some cases like while uninstalling game center on realme 6. This command can be used on many devices I have tried it on redmi note 7, realme 3 and realme 6.
Here is a guide you can follow - https://www.xda-developers.com/uninstall-carrier-oem-bloatware-without-root-access/
and other one is https://fossbytes.com/delete-bloatware-from-android-preinstalled-apps/.
Here 0 represents the user id...so you may want to look on which user an app is installed. Refer to the guide for adb installation and more.
Sorry, I also couldn't uninstall app market, game center from my device.
But I uninstalled oroaming successfully.
pm uninstall –k ––user 0 com.redteamobile.roaming
Use this to remove oroaming.

[GUIDE] How to remove Facebook Services and other bloatware WITHOUT Root

I was very dissapointed to see that Oneplus now ships more bloatware such as Facebook with it´s phones. While you can uninstall the app itself, there are a few Facebook-related frameworks in the background that cannot be uninstalled that easy. However with a couple quick ADB command you can solve that problem in a few minutes. With this method you can remove unwanted apps for the (current) user while not touching the firmware thus keeping OTA updates working.
You need:
- A Computer
- Fastboot --> I use: https://forum.xda-developers.com/showthread.php?t=2317790
- USB - Debugging ENABLED on your phone
How to do it:
Simply connect your phone via USB and open the ADB command window and type the following
("-k" will leave the cache intact, you ca remove this part if you want to clean up even more. However I had problems without it in the past in rare cases so I included it)
Code:
adb shell
pm uninstall -k --user 0 com.facebook.appmanager
pm uninstall -k --user 0 com.facebook.services
pm uninstall -k --user 0 com.facebook.system
Once thats done reboot your phone. Done.
thx for the guide..
just wanna ask, if there is root, can the "-k --user 0" part be omitted to really completely remove all facebook trash?
tia..
iamelton said:
thx for the guide..
just wanna ask, if there is root, can the "-k --user 0" part be omitted to really completely remove all facebook trash?
tia..
Click to expand...
Click to collapse
With root I would try this instead.
Code:
adb shell
su
mount -o rw,remount /system
rm -rf /system/app/[I]unwanted.apk[/I]
rm -rf /data/data/[I]package[/I]
mount -o ro,remount /system
exit
Even without root you could leave the "-k" out but since it only leaves the cache intact I thought to include it just in case.
Saiger said:
With root I would do this instead.
Code:
adb shell
su
mount -o rw,remount /system
rm -rf /system/app/[I]unwanted.apk[/I]
rm -rf /data/data/[I]package[/I]
mount -o ro,remount /system
exit
Even without root you could leave the "-k" out but since it only leaves the cache intact I thought to include it just in case.
Click to expand...
Click to collapse
thx a lot..
since this time its deleting the apks directly, could you provide the apk file names of the facebook framework as well?
or better, add them to the first post so that others may benefit..
iamelton said:
thx a lot..
since this time its deleting the apks directly, could you provide the apk file names of the facebook framework as well?
or better, add them to the first post so that others may benefit..
Click to expand...
Click to collapse
Sure here you go:
Code:
com.facebook.system -> Facebook App Installer
com.facebook.appmanager -> Facebook App Manager
com.facebook.services -> Facebook Services
But with root I would just use an app instead else its too much a hassle
..
DIR49DNOR0N said:
Dare to recommend a reliable root file manager that's good for this?
I'd also be interested if there's any difference in removing the package files vs disabling them via ADB? my current understanding: there is none except you gain back the megabytes
Click to expand...
Click to collapse
I always used Titanium Backup for uninstalling apps however there seems to be an expection with OOS were it can´t remove the apps from the system folder making it useless. I have to check that.
As for disabling vs removing the files, you are right there´s no difference between them when it comes to stopping them from working on the backround and so on.
..
Lovely ! Thanks a lot.
When the next OTA update will be released, will the apps reinstall again on the device, or it is a one-time thing to do ?
Logiel said:
Lovely ! Thanks a lot.
When the next OTA update will be released, will the apps reinstall again on the device, or it is a one-time thing to do ?
Click to expand...
Click to collapse
It´s a one time thing. They will stay uninstalled for the current user.
my OPN just arrived today, and i discovered that beside Facebook, there are also Instagram & Messenger pre-installed..
while the latter two apps can be uninstalled, are there any framework apps related to these 2 apps that should be disabled?
tia..
iamelton said:
my OPN just arrived today, and i discovered that beside Facebook, there are also Instagram & Messenger pre-installed..
while the latter two apps can be uninstalled, are there any framework apps related to these 2 apps that should be disabled?
tia..
Click to expand...
Click to collapse
Since instagram and messenger are from Facebook they all share the same "behind the scenes" framework. So you don´t have to disable anything else.
iamelton said:
my OPN just arrived today, and i discovered that beside Facebook, there are also Instagram & Messenger pre-installed..
while the latter two apps can be uninstalled, are there any framework apps related to these 2 apps that should be disabled?
tia..
Click to expand...
Click to collapse
Specifically: com.facebook.services , com.facebook.system , com.facebook.appmanager, uninstall these in adb. Thankfully instagram is not a system app, uninstall is enough :good:
Can we also delete any other apps e.g. play movies etc?
funnybones said:
Can we also delete any other apps e.g. play movies etc?
Click to expand...
Click to collapse
yea just replace the package name with the one from the app you want gone: com.google.android.videos
is safe to say that disabling the three services i get the same result ?
raoh980 said:
is safe to say that disabling the three services i get the same result ?
Click to expand...
Click to collapse
pretty much yes
funnybones said:
Can we also delete any other apps e.g. play movies etc?
Click to expand...
Click to collapse
using App Inspector from play store you can get the exact name of each app you want to remove
Hey i Just got my Nord (EU Version) and I was able to just uninstall the preinstalled apps without ADB. Just like every other app I could completely remove it (not deactivate).
Jonny108 said:
Hey i Just got my Nord (EU Version) and I was able to just uninstall the preinstalled apps without ADB. Just like every other app I could completely remove it (not deactivate).
Click to expand...
Click to collapse
the facebook framework apps are the part that has to be deactivated (since they cannot be uninstalled without root)..

Categories

Resources