1、安装android studio后
确认adb目录,一般目录在/Library/Android/sdk/platform-tools,代表当前用户的根目录
command+shift+G 到这个路径~/Library/Android/sdk/platform-tools 查看是否有安装adb
2、command+shift+G 到这个路径~/Library 编辑.bash_profile
添加platform-tools路径,我的是这个
export PATH=${PATH}:~/Library/Android/sdk/platform-tools
在终端输入,让修改的bash_profile起作用
source ~/.bash_profile
安装方法1:
adb -s 710KP457748 install -t /Users/sndy/Desktop/ofun-sdk.apk
710KP457748: 是你的设备,通过adb devices查看
安装方法2:
adb -s befecc13 push /Users/sandy/Desktop/app-release.apk /sdcard/Downloads
befecc13: 是你的设备,通过adb devices查看
/sdcard/Downloads:安装在sdcard内存卡里面的Downloads文件下,在手机上的文件管理里面
adb其他用法:
1、手机截图
cd 到保存截图到路径
adb exec-out screencap -p > screen.png
2、在终端查看日志
adb -s emulator-5554 logcat
emulator-5554:模拟器名称/手机名称,通过adb devices查看