adb 常用命令

常用命令
1. 安装工具adb
2. 使用双公头USB线将网关连上电脑
08
2、在命令行,查看设备,会返回设备序号:
C:\Users\Lenovo>adb devices
List of devices attached
f48……371 device
3.获取 MAC 地址
adb shell
cd /sys/class/net/eth0
cat address
08:54……


2、安装应用程序到设备上
C:\Users\Lenovo>adb install -r -s f4……371 f:\androidv30.1.2.5.f.apk
[100%] /sdcard/tmp/androidv30.1.2.5.f.apk
pkg: f48e929e7371
ver: /sdcard/tmp/androidv30.1.2.5.f.apk
Failure [INSTALL_FAILED_INVALID_URI]

说明:-s 设备序号,这里有空格,另外,设备需要有存储卡,-s会将应用程序安装到SD-Card。

C:\Users\Lenovo>adb install -r f:\androidv30.1.2.5.f.apk
[100%] /data/local/tmp/androidv30.1.2.5.f.apk
pkg: /data/local/tmp/androidv30.1.2.5.f.apk
Success
3、卸载软件:
adb uninstall [shell pm -k] <软件名>
说明:暂时还不知道怎么获取手机上app的软件名—英文的,中文的可以吗?
4、从设备上发送文件到电脑上:
C:\Users\Lenovo>adb pull /log/charge.old charge.old
[100%] /log/charge.old

C:\Users\Lenovo>cd f:
F:\
C:\Users\Lenovo>f:
F:\>adb pull /log/charge.old charge.old
[100%] /log/charge.old
说明:adb pull [手机上文件路径] [电脑上的文件名称],这里不能指定电脑上的路径(需要看看是什么原因),若目标路径不是当前目录,需要先切换到目标路径,再执行pull操作。
5、从电脑上发送文件到手机上:
F:\>adb push g:/newfile.txt /log/new_file.txt
[ ?] /log/new_file.txt: 0/?
成功了的。。。
6、显示帮助信息
adb help
7、显示ADB命令版本号
adb version
8、启动或关闭计算机 上adb服务进程
adb start [kill] -server


9.列出手机装的所有app的包名:
adb shell pm list packages
列出系统应用的所有包名:
adb shell pm list packages -s
列出除了系统应用的第三方应用包名:
adb shell pm list packages -3

10.清除应用数据与缓存
有些时候我们测试需要清除数据与缓存,则需要用到如下命令:
adb shell pm clear <packagename>
11.查看日志
adb logcat
12.重启
13.adb reboot
获取序列号
adb get-serialno
02ae0c1021089daf
14.查看设备型号
adb shell getprop ro.product.model
Nexus 5
查看 Android 系统版本
adb shell getprop ro.build.version.release
7.0.1
查看屏幕分辨率
adb shell wm size
Physical size: 1080×1920
查看屏幕密度
adb shell wm density
15.发布端口
可以设置任意的端口号,做为主机向模拟器或设备的请求端口。如:
adb forward tcp:5555 tcp:8000

 

 

 

 


adb shell指令
安卓系统是基于Linux系统开发的,支持常见得Linux命令:adb shell [command]
adb shell ls 查看手机目录的所有内容:

 


上面的命令也可分解为下面的两行命令:
F:\>adb shell
shell@hwG7-TL00:/ $ ls

 

posted @ 2018-01-04 15:57  幸福在今天  阅读(477)  评论(0编辑  收藏  举报