adb、emulator、android指令
adb命令大全
adb命令pm工具讲解
adb 指令
常用
- 安装:
adb install [文件路径]
- 卸载:
adb uninstall -r [文件路径]
- 杀死APP:
adb shell am force-stop [包名,如:com.wx.meitu]
- 启动APP:
adb shell am start -n [包名/Activity类的类名]
- 重启设备:
adb reboot
- tcpip, 例:
adb tcpip 5555 (端口号)
adb -s [设备] tcpip 5555 (指定设备,通过<adb devices>查看有哪些设备)
adb connect 192.168.1.199 (根据局域网ip连接指定设备,默认端口5555)
adb disconnect (断开所有连接设备)
adb disconnect 192.168.1.199:5555
其他
- 帮助:
adb --help
- 杀死adb:
adb kill-server
- 退出adb shell:
exit
- 设置默认安装位置:
adb shell pm set-install-location [0/1/2]
,0:自动,1:内存,2:sd卡
- 更多
多设备情况,需要指定操作的设备:
- 查看有哪些已经启动的设备:
adb devices
- 加
-s
指定设备,后面跟具体操作,如:adb -s [设备] shell
adb shell
- 命令拼接如:
adb shell
+ pm set-install-location [0/1/2]
- su使用:
su
单独使用,后面不能跟命令,与linux不一样
emulator指令
- 帮助:
emulator -help
- 列出已创建(并非已启动)的模拟器:
emulator -list-avds
- 启动模拟器:
emulator -avd [设备]
。可能报错PANIC: Missing emulator engine program for 'x86' CPU.
,这是因为我们环境配置的sdk下的文件夹tools
下的命令不全,需要将tools
文件夹替换成emulator
文件夹。这样的话,android
指令就不能用了,不过没关系,本来就不怎么用。Mac下的配置:
export PATH="$PATH:~/Library/Android/sdk/platform-tools"
# export PATH="$PATH:~/Library/Android/sdk/tools"
export PATH="$PATH:~/Library/Android/sdk/emulator"
android指令,该指令已经过时,但还能用,打印的list
信息比较详细
- android list target #列出所有可用SDK
- android list avd #列出所有已创建模拟器,带详细信息
- android list device
- android create avd
- android move avd
- android delete avd
- android list sdk
- android update sdk
本文标题:adb、emulator、android指令
本文链接:https://www.haomeiwen.com/subject/qujrottx.html
网友评论