1.获取APP包名
- adb命令获取包名
1)启动APP
2)
wins: adb shell dumpsys window | findstr mCurrentFocus
mac: adb shell dumpsys window |grep mCurrentFocus - aapt命令获取包名
aapt dump badging + apk所在的绝对路径 + apk文件名称
2.获取系统版本:
adb shell getprop ro.build.version.release
3.查看连接的设备:
adb devices
3.连接安卓机器:
一台机器:
adb shell
多台机器:
adb -s 192.168.57.105:5555 shell getprop ro.build.version.release
4.获取apk 入口Activity
- aapt dump badging 加apk的路径 加竖线 | findstr launchable-activity
- adb logcat | grep -i displayed
5.获取当前界面元素:
adb shell dumpsys activity top
6.获取任务列表:
adb shell dumpsys activity activities
7.关闭应用:
adb shell pm clear $package;
adb shell pm force-stop $package;
8.启动应用
adb shell am start -S -W $package/Activity名称
9.安装/卸载apk
adb -s emulator-5555 install helloWorld.apk
adb shell pm uninstall com.example.MyApp
10.复制某个文件或目录
adb pull remote local
11.将某个文件或目录(及其子目录)复制到设备
adb push local remote
链接:https://developer.android.google.cn/studio/command-line/adb?hl=zh-cn