android:那些常用的adb命令

来源:互联网 发布:js thread.sleep 编辑:程序博客网 时间:2024/06/01 20:33


1.列举当前的设配:
adb devices
例如:
localhost:~ newuser$ adb devices
List of devices attached 
BH903QDW15device
41008990d29eb000device


2.针对某一个设备进行
adb -s <serialNumber> <command> 
例如:
adb -s BH903QDW15 install hello.apk


3.安装app
adb install <path_to_apk>


4.文件复制
4.1从手机拉到本地
adb pull <remote> <local>
例如:
adb pull /sdcard/foo.txt  foo.txt
4.2从本地推到手机
adb push <local> <remote>
例如:
adb push foo.txt /sdcard/foo.txt


5.卸载软件
adb shell pm uninstall <packageName>
例如:
adb -s BH903QDW15 shell pm uninstall -k com.example.hello
-k 卸载之后保留数据
注:adb shell pm [command]
有很多命令:详见:http://developer.android.com/tools/help/adb.html


6.屏幕录制:
adb shell screenrecord /sdcard/demo.mp4
录制完之后,可以通过pull,将文件复制到本地,参见4.1


7.查看所有的adb shell指令
adb shell ls /system/bin


8.在屏幕上随机点击测试:
adb shell monkey -v -p <packageName> <number>


9.列举所安装软件的包名:
adb shell pm list packages
例如,列举第三方软件的包名:

adb shell pm list packages -3


10.查看打印的日志

adb logcat

例如:

输出错误日志 adb logcat E

Logcat的过滤:

adb logcat | grep -i "debug"

包含debug字符串的日志

更多命令:http://developer.android.com/tools/help/adb.html

-------------------------------------------------------------------

更多交流,Android开发联盟QQ群:272209595


0 0