如何从设备上的命令行卸载Android应用 [英] How to uninstall an android app from command line on the device
问题描述
我可以使用adb uninstall <package_name>
从计算机上卸载设备上的应用,
但我想对实际设备上的脚本执行相同的操作.
I can uninstall an app on the device from my computer using adb uninstall <package_name>
,
but I'd like to do the same with a script on the actual device.
我也尝试过使用am
运行android.intent.action.DELETE
意图,但是它提示用户进行确认.
I've also tried running an android.intent.action.DELETE
intent using am
but it prompts the user for confirmation.
鉴于设备已扎根,是否可以在设备上运行命令以卸载应用程序而无需用户采取行动/确认?
Given that the device is rooted, is it possible to run a command on the device to uninstall an app without requiring user action/confirmation ?
推荐答案
尝试使用 pm
命令:
Trying using the pm
command:
pm uninstall <package_name>
或
pm uninstall -k <package_name>
-k
标志在删除程序包后保留数据和缓存目录.
The -k
flag keeps the data and cache directories after the package is removed.
我自己还没有测试过,但是我不认为这应该显示警告消息.
I haven't tested this myself, but I don't think this should show a warning message.
这篇关于如何从设备上的命令行卸载Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!