首先,需要对adb进行解释。
什么是adb呢?Adb是
Android debug bridge(Android调试桥)的缩写。adb是一个C/S架构的命令行工具,3部分构成:
(1)、adb client端(运行在电脑上)
tips:电脑上最好不要安装
手机助手等软件,这样会占用adb的默认端口:5037
用于管理client和Andriod的adb后台进程
(3)、adb后台进程(运行在手机上)
主要是以下命令查看后台进程:adb
shell ps|grep adbd
其次, adb命令的分类:包括adb类、adb shell类和linux类。
下面分别介绍
----------------------------------------------------------
(1)、adb类:命令格式 adb [-e|-d|-s<设备序列号>....] <子命令>
可通过 adb help或者adb命令查看
例如:C:\Users\USER>adb
Android Debug Bridge version 1.0.31
-a - directs adb to listen on all interfaces for a connection
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_SERIAL
environment variable.
adb类常用命令包括:
1、adb devices 获取设备的id
2、adb get-state 获取设备的状态,结果包括device(正常)、offline(异常)、unkwon(无设备)
3、adb kill-server(结束adb服务)、adb start-server(启动adb服务),通常组合使用
4、adb logcat 查看andriod系统日志,可以通过>重定向到制定的路径下面
5、adb bugreport ,输出内容非常多、可以打印dumpsys\dumpstate\logcat信息,建议也重定向导出
6、adb install (-r) application.apk 安装(覆盖)应用
7、adb uninstall application.apk 卸载应用
8、adb pull sdcard/demo.doc D:/将sdcard中的demo.doc文件复制到D盘
9、adb push D:/demo.doc sdcard/将d盘下面的demo.doc复制到sdcard中
10、adb reboot 重启机器
11、adb connect远程连接Andriod设备(通过wifi进行连接,需要在同一局域网内,通常需要root权限)
adb connect ip
------------------------------------------------------------
(2)adb shell命令,待续