I'm trying to uninstall an application from shell, however this application is running as a device administrator and thus shell> adb uninstall com.example.test
did not work.
How can I disable a device admin from shell?
I'm trying to uninstall an application from shell, however this application is running as a device administrator and thus shell> adb uninstall com.example.test
did not work.
How can I disable a device admin from shell?
"adb shell pm disable-user pkgname" will deactive DeviceAdmin and freeze the app. It will not be active again even if you enable the app.
(Tested on Samsung Galaxy S7 with 8.0 Oreo)
Typically, administrative access is revoked via the Device Administrators screen, then the app is uninstalled. In the subsequent examples, I'll assume airdroid (
com.sand.airdroid
), has been configured as a device administrator, and is to be uninstalled. So to tailor this example, replace instances ofcom.sand.airdroid
with your own app name.The clean method
To access Device Administrators, navigate: Settings → Security → Device Administrators. Then, uncheck the application to un-set administrative access for.
It's also possible to open up this activity using the shell:
Once this is done, the activity can be uninstalled normally:
The brute-force method (requires root)
A brute-force method does exist. It involves searching for all files in the /system and /data filesystems, and deleting each found item. Disclaimer: Use with care (test on an emulator first).
...a list of files (including directories) appears -- for each file, cause it to be deleted by prefixing it with a
rm -f
:To allow Android to clean up its files, reboot the device.
Once the device has restarted, the application can be uninstalled with the
uninstall
command to finalize clean-up.