e.g.
Install apk for Android:
adb install C:\Users\Administrator\Downloads\app.apk
Uninstall specific user app:
adb uninstall 'com.example.app'
List installed app package names:
adb shell pm list packages
Disable specific app (without root required):
adb shell pm disable-user 'com.example.app'
Enable specific app:
adb shell pm enable 'com.example.app'
Uninstall specific system or user app:
adb shell pm uninstall -k --user 0 'com.example.app'
命令的各个部分解释如下:
adb shell: 启动 Android 设备的 shell(命令行界面)。
pm: PackageManager(包管理器)的缩写,它是 Android 系统的一个组件,用于管理应用程序包和安装、卸载应用等操作。
uninstall: 指示 PackageManager 卸载一个或多个应用程序包。
-k: 指示卸载应用程序时保留其数据和缓存目录。这意味着虽然应用程序被卸载了,但与其相关的数据文件和缓存仍然存在于设备上。
--user 0: 指定要执行操作的用户。在 Android 系统中,每个用户都有一个唯一的用户 ID,0 代表设备的主用户或所有者。
'com.example.app': 要卸载的应用程序包的包名。
Restore system app:
adb shell cmd package install-existing 'com.example.app'