How to delete non-system apps from android using adb? [duplicate] - android

This question already has answers here:
How can I use adb to uninstall all 3rd party user apps?
(2 answers)
Closed 5 years ago.
I am trying to write a script to clean up android devices before some automated tasks. So I'm looking for some way to remove all the non-system apps from the phone, using adb, as I continuously find that people love installing heavy games on those devices. (These are our work devices) :D I couldn't find anything useful till now, as most questions I found were about deleting the system apps.
I am able to list all the installed apps using adb
adb -s <device id> shell pm list packages -f | cut -d '=' -f 2
But that gives all the apps that are installed, including some of these:
com.android.backupconfirm
com.android.packageinstaller
com.android.providers.userdictionary
com.android.providers.downloads.ui
com.android.externalstorage
com.google.android.nfcprovision
com.google.android.apps.docs.editors.docs
com.google.android.apps.cloudprint
I'm afraid, if I accidentally uninstall them, the phone will become useless.
Can someone suggest a way to delete only the applications installed by others ?

for pkg in $(adb shell pm list packages -3 | cut -d: -f2); do
adb uninstall $pkg
done

Related

Apk is disappearing after moving to system parition

I'm trying to install my apk on system partition. I've rooted device and here are the steps I'm following,
adb install -d -r <apk_name>
Now apk gets installed in /data/app/<apk_name>/
Move all contents present from /data/app/<apk_name> to /system/priv-app/<apk_name>
Clear the contents within /data/app/<apk_name> and reboot the device
Post reboot not able to find my apk under adb shell pm list packages | grep <apk_name>
I'm trying to read and write value to secure setting which is asking my app to be in system partition. When I'm trying to move I'm facing this issue. I could not find something suspicious from logs while installing the apk.
Tried all possible solutions listed here (Android 5.0/Lollipop: Force rescan of /system/priv-app) but none didn't help.
Any help to debug this issue would be really helpful.

Failure - not installed for 0

I am trying to uninstall a few Google APKs that were preinstalled on an older smartphone I have.
I must do it via ADB because it's not possible to do it via regular uninstall
I found a guide on how to remove those APKs using ADB, but when I try to remove a certain Google package, for example com.google.apps.plus, using the following command:
pm uninstall -k --user 0 com.google.apps.plus
I get the following error: Failure - not installed for 0
What am I missing?
Even I was facing the same issue. For solving this problem just make sure that you have the latest USB drivers for your device. You can get your drivers from Android Devs Website. This is a list of all major OEM's compiled by google. Then download ADB tools from here. After ensuring the above steps, download any App Inspector application from play store for getting the exact package name of the apps.
In your device's Developer Options,turn on USB debugging. Open Windows PowerShell where you have downloaded the ADB tools.To see if ADB is working use .\adb command.
Then use .\adb shell for activating adb shell. Then use this command for removing the packages pm uninstall -k --user 0 <package name>. You will get package name in the App Inspector application.
In my case I had the weverse app, what I did was:
Open the app (it required me to update it)
Update the app in the PlayStore
Close the app Uninstall with the common command
pm uninstall -k --user 0 "package name"

aggressive adware irremovable apk on android

A few days ago I received complaints from several customers who told me that "adware is installed automatically on your device Krono NET K5". I made invesigar and found a few apk on / system / app that had different permissions to the usual "rw-r - r--". I could erase the few simple steps in a shell:
adb shell "su -c 'mount -o rw, remount /'"
adb shell "su -c 'rm /system/app/156.apk'"
adb shell "su -c 'rm /system/app/Launcher0607wxDjbOa.apk'"
adb shell "su -c 'rm /system/app/Sync.apk'"
adb shell "su -c 'rm /system/app/SettingProvider.apk'"
(Note that a suspect name as there is a apk using the system call SettingsProvider.apk with letter s)
So far everything worked properly, however there is a apk which is the main cause of all adware and causing the discharge cone apk other battery savers, system cleaners, among others. This application is:
"/system/app/providerdown.apk" Permits "rwsr-sr-x"
I tried to remove it by the above method, I tried to change the permissions to remove it and it has not worked. I tried to install a recovery to eliminate apk thence Aroma File Manager (CWM, TWRP) MTK but this device does not support any custom recovery for devices MTK.
Any idea? Thanks in advance (sorry for my bad english)
I have same problem. You will have to be rooted for this, but i guess you have root because of that code you wrote, and the fact that app somehow gains root access and installs itself in system. Only thing I did to make things easier is:
Download Avast to your phone.
Download Clean Master to your phone and with Clean master make backup of your avast apk.
Go to your stock recovery. I used an app from google store to boot to recovery but any way is good.
Clean cache and do a factory reset.
Boot the device.
DO NOT CONNECT DEVICE TO ANY NETWORK.
Just skip all the stuff like login to your google account and other settings.
Find your Avast apk in the sd card and install it.
Turn on firewall and block all acces to TimeService-that is the name that apk uses when seen from android system.
Go to android system and disable time service. It is probably version 1.1.6
You will still have malware in your device but it wont make mess anymore.
I would like the permanent solution too.

Uninstalling bloatware application using adb

Hello all,
I want to remove applications that were on my phone since the beginning but I don't use them. I have Sony Xperia P and one of the apps I want to get rid of is joyn, which uses about 20% of battery although I don't use it and I also tried disabling all of its parts in settings/applications (with no luck).
I rooted my phone and tried to use adb to uninstall the app but the attempt always fails.
What I did:
C:\adb -s YT9100UAAX shell
shell#android:/ $ su
The first time on the phone, I needed to allow access to super user in SuperSU application and from now on the ABD shell is in the list of elevated applications in SuperSU.
root#android:/ # pm uninstall com.rechild.advancedtaskkiller
Success
Regular application uninstallation works fine, but when I try to uninstall something else I get:
root#android:/ # pm uninstall com.orangelabs.rcs
Failure
root#android:/ # pm uninstall com.vodafone.vodafone360updates
Failure
What am I doing wrong?
Thanks for the help
Based on corsair992's advice I downloaded Titanium Backup and I was able to uninstall everything I wanted (incl. the bloatware). Didn't know this app was so powerful!
Thx a lot corsair992

Android adb & adbd

I have next situation:
I got 2 version of adb and 2 versions of adbd on 2 different devices.
How can i use both versions of adb from my workstation for these 2 devices.
I mean:
1 adb for 1 device.
2 adb for 2 device.
Now i have following situation:
Every time when i run another adb, previous adb server kills and new one starts.
How can I workaround it?
I think you are asking the wrong question. What I think you want is to run two adb commands at once on different phones. Is that correct?
If so what you are looking for is
adb -s DEVICE_SERIAL xxx
where DEVICE_SERIAL is the value shown when you run adb devices and xxx is the command you want to run. Use adb devices for a list of connected devices.
This only requires you to have one version of adb installed, just open up a new terminal and run the command for the different serial numbered device!
If I'm understand the question correctly I believe he's trying to run two different versions of ADB at the same time. If my assumption is correct then here is what you'd want to do.
Lets assume you have adb.1.0.29.exe and adb.1.0.39.exe on the root of the c: drive which were renamed from the adb.exe from the different versions of platform-tools SDK versions they were supplied in.
To run the ADB version contained within adb.1.0.29.exe all you have to do is what the linked articles say BUT be sure to call the proper exe for that version. I used these adb version names as examples. You can name the adb.exe whatever you want.
So you can call adb commands with different versions as follows,
c:\adb.1.0.29.exe -s serial_of_device adb_command
or
c:\adb.1.0.23.exe -s serial_of_device adb_command
Cheers,
-Rob

Categories

Resources