① 通过 ADB 命令卸载小米手机预装软件
为了卸载小米手机预装软件,您需要遵循以下步骤:
首先,确保您已下载并解压了android SDK Platform工具包。工具包下载地址如下:
SDK平台工具版本说明 | Android开发者 | Android开发者网站
然后,将adb.exe、Adbwinapi.dll、Adbwinusbapi.dll三个文件复制到C:\Windows文件夹,这样可以在cmd窗口中直接使用adb命令。这样做的好处是节省操作时间,便于创建批处理文件。
在手机设置中开启“开发者选项”和“USB调试”。接着,用数据线将手机连接到电脑。如果连接失败,可能需要安装手机驱动,小米官方的刷机工具中通常包含此功能。
在解压的platform-tools文件夹中打开Powershell窗口。在该窗口中,您可以使用adb命令。先运行确认ADB连接是否正常的命令,若显示手机设备编号,则表示连接成功。如果连接失败,请尝试更换USB端口或数据线。
要卸载软件,您需要知道软件的包名。在MIUI的“应用设置”中查看软件列表。对于每个软件,点击其右上角的带有小写字母i的按钮以打开“应用详情”页面,找到并记录软件包名。以小米钱包为例,其包名为com.mipay.wallet。
在禁用或卸载软件前,建议先停止软件运行。使用adb命令停止软件运行,其中包名替换为目标软件的名称。要禁用软件,使用特定命令;要恢复软件,使用另一命令。要完全卸载软件,使用删除命令。
以下为执行步骤的命令示例:
停止运行命令示例:
禁用软件命令示例:
恢复软件命令示例:
卸载软件命令示例:
当显示“Success”字样时,表示卸载成功。
在Windows cmd窗口中使用adb命令时,确保将adb.exe、Adbwinapi.dll、Adbwinusbapi.dll三个文件复制到C:\Windows文件夹,以便在cmd窗口中直接使用adb命令。
最后,列出可删除的软件列表,以供参考。请注意,实际可删除的软件取决于您的手机型号和MIUI版本。在Redmi K40手机上测试,使用这些步骤成功卸载了多个预装软件,且手机未出现变砖现象。
② android 中linux 命令pm常见用法(安装卸载app)
27种用法格式 :
用法说明 :
1、 pm list packages : prints all packages, optionally only those whose package name contains the text in FILTER. Options:
例子:列出系统中所有packages
2、 pm list permission-groups : prints all known permission groups.
例子:
3、 pm list permissions : prints all known permissions, optionally only those in GROUP. Options:
例子:列出系统所有许可
4、 pm list instrumentation : use to list all test packages; optionally supply to list the test packages for a particular application. Options:
-f: list the .apk file for the test package.
5、 pm list features : prints all features of the system.
例子:列出所有手机特性
6、 pm list users : prints all users on the system.
例子:
7、 pm path : print the path to the .apk of the given PACKAGE.
例子:按包名查找apk文件所在路径
8、 pm mp : print system state associated with the given PACKAGE.
9、 pm install : installs a package to the system. Options:
例子:
10、 pm uninstall : removes a package from the system. Options:
-k: keep the data and cache directories around after package removal. 保留数据
例子:
11、 pm clear : deletes all data associated with a package..
例子:只删除数据
12、 pm enable, disable, disable-user, disable-until-used : these commands change the enabled state of a given package or component (written as "package/class").
13、 pm grant, revoke : these commands either grant or revoke permissions to applications. Only optional permissions the application has declared can be granted or revoked.
14、 pm get-install-location : returns the current install location.
15、 pm set-install-location : changes the default install location.
NOTE: this is only intended for debugging; using this can cause applications to break and other undersireable behavior.
16、 pm trim-caches : trim cache files to reach the given free space.
17、 pm create-user : create a new user with the given USER_NAME, printing the new user identifier of the user. 创建新用户
18、 pm remove-user : remove the user with the given USER_IDENTIFIER, deleting all data associated with that user 。 按用户ID删除用户