- 安装brew cask install android-platform-tools
- 开发者模式+usb调试模式
- 配置adb环境变量 source ~/.bash_profile
export ANDROID_HOME=/Users/sakurahappy/Library/Andriod/android-sdk-macosx
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
- 查看已连接设备adb devices
查看应用列表adb shell pm list packages ( -3 -u
安装adb install <apk file>
卸载应用adb unstall [-k] <packagename> (-k保存数据/缓存目录)
清除数据和缓存adb shell pm clear <packagename>
打印日志adb logcat com.lucky.luckyclient:W
打开微信终端 adb shell am start -n com.tencent.mm/.ui.LauncherUI
获取分辨率adb -s 5LH5T19614003133 shell wm size
通过ip连接adb connect <device-ip-address>
前台进程adb shell dumpsys activity activities
获取前台进程intent内容 adb shell dumpsys activity activities | grep cmp
调起服务adb shell am startservice -n
复制手机文件到电脑adb pull <设备里的文件路径> [电脑上的目录]
相反push 都需要root
模拟按键输入adb shell input keyevent 4 - adb root 为什么没找到啊啊啊啊
- adb logcat | grep START
05-21 19:50:16.042 1228 10154 I ActivityTaskManager: START u0
{act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10200000 hwFlg=0x10
cmp=com.android.calculator2/.Calculator bnds=[647,746][855,1061]} from uid 10079
包名:com.android.calculator2 activity:.Calculator