more than one device/emulatoradb install xxx/xxx/appName.apk>完成安装adb install 完成安装即可File Transfer(文件传输)默认Additional settings/Developer options/Default Use configuration/File Transfer检查设备链接情况
PS C:\Users\cxxu\Desktop\n11tp> adb devices
List of devices attached
UO7PKFNF99IR9TV4 device
执行安装
PS C:\Users\cxxu\Desktop> adb install .\magisk.apk
Performing Streamed Install
Success
看到success,说明安装成功
上述命令在2类情形下可以执行:
C:\Users\xxxx\Desktop> adb所在目录被配置环境变量Path中adb uninstall
例如:卸载酷安应用市场:
PS C:\Users\cxxu\Downloads> adb uninstall com.coolapk.market
Success
如果要降级安装某些应用,通常,就需要先卸载新版本,再安装老版本
xaga:/sdcard $ install magisk.apk
install: Needs 2 arguments
PS C:\Users\cxxu\Desktop\n11tp> adb install .\magisk.apk
adb.exe: more than one device/emulator
初步排查:
使用adb devices -l检查当前列表
-l会列出设备更加详细的信息,推荐加上,可看到设备型号下面是adb 将设备识别为多模拟设备
这可能是根手机端选择的链接方式的选项有关!
从而导致虽然只连接了一台设备,却扫描出了2台设备(包括模拟设备,应该是您的选项Use USB for 的选项更换之后导致的)
PS C:\Users\cxxu> adb devices
List of devices attached
UO7PKFNF99IR9TV4 device
emulator-5554 offline
如果向上面所讲的那样,发现了多台设备,那么考虑如下做法:
断开所有adb链接:adb kill-server
然后重新检查设备列表
PS C:\Users\cxxu> adb kill-server
PS C:\Users\cxxu> adb devices -l
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
UO7PKFNF99IR9TV4 device product:xaga model:22041216C device:xaga transport_id:1
您也可以选择跳过adb kill-server,通过追加选项-s指定设备参数
这样就不会导致设备指代不明的错误
如果您链接了多个android设备(包括虚拟设备),
adb -s xxx xxx代指的是设备序列号,例如上面的UO7PKFNF99IR9TV4开发者选项相关开关为正确开启,也可能导致相应错误
PS C:\Users\cxxu\Desktop\n11tp> adb install .\magisk.apk
Performing Streamed Install
adb: failed to install .\magisk.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
dumpsys package
例如,查看酷安的版本:
windows_x86_64:/$ dumpsys package com.coolapk.market|grep versionName -i
versionName=13.1.3
adb shell clear
例如
PS C:\Users\cxxu\Desktop> adb shell pm clear com.android.settings
Success
例如刷入的某些模块导致系统无法正常运行,(比如卡在锁屏界面),可以尝试清除受怀疑的模块或者禁用它
PS C:\Users\cxxu> adb
Android Debug Bridge version 1.0.41
Version 33.0.2-8557947
Installed as D:\exes\platform-tools\adb.exe
....省略篇幅....(跳过,直达主题:..app intallation
app installation (see also `adb shell cmd package help`):
install [-lrtsdg] [--instant] PACKAGE
push a single package to the device and install it
install-multiple [-lrtsdpg] [--instant] PACKAGE...
push multiple APKs to the device for a single package and install them
install-multi-package [-lrtsdpg] [--instant] PACKAGE...
push one or more packages to the device and install them atomically
-r: replace existing application
-t: allow test packages
-d: allow version code downgrade (debuggable packages only)
-p: partial application install (install-multiple only)
-g: grant all runtime permissions
--abi ABI: override platform's default ABI
--instant: cause the app to be installed as an ephemeral install app
--no-streaming: always push APK to device and invoke Package Manager as separate steps
--streaming: force streaming APK directly into Package Manager
--fastdeploy: use fast deploy
--no-fastdeploy: prevent use of fast deploy
--force-agent: force update of deployment agent when using fast deploy
--date-check-agent: update deployment agent when local version is newer and using fast deploy
--version-check-agent: update deployment agent when local version has different version code and using fast deploy
(See also `adb shell pm help` for more options.)
uninstall [-k] PACKAGE
remove this app package from the device
'-k': keep the data and cache directories
根据帮助文档
adb shell cmd package help):
adb install来调用,因为install package是adb可执行文件提供的命令接口