adb工具

Posted 李白你好

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了adb工具相关的知识,希望对你有一定的参考价值。

日志记录

I:\\APP测试\\drozer>adb connect 127.0.0.1:62001
connected to 127.0.0.1:62001

I:\\APP测试\\drozer>adb devices
adb server version (36) doesn't match this client (41); killing...
* daemon started successfully
List of devices attached

I:\\APP测试\\drozer>adb logcat -s diva-log
--------- beginning of main
--------- beginning of system
--------- beginning of crash
02-14 15:56:33.070  3384  3384 E diva-log: Error while processing transaction with credit card:
02-14 15:56:34.597  3384  3384 E diva-log: Error while processing transaction with credit card:
02-14 15:56:34.702  3384  3384 E diva-log: Error while processing transaction with credit card:
02-14 15:56:57.173  3384  3384 E diva-log: Error while processing transaction with credit card: 12
02-14 15:57:02.947  3384  3384 E diva-log: Error while processing transaction with credit card: 444412
02-14 15:57:03.363  3384  3384 E diva-log: Error while processing transaction with credit card: 444412
02-14 15:57:03.495  3384  3384 E diva-log: Error while processing transaction with credit card: 444412

进入到shell查看日志

I:\\APP测试\\drozer>adb shell
d2q:/ # ps | grep diva
u0_a52    9094  1878  973204 101196            d770ecc0 S jakhar.aseem.diva

I:\\APP测试\\drozer>adb logcat | findstr 9094
02-14 14:49:11.788  2170  2335 I ActivityManager: Start proc 9094:jakhar.aseem.diva/u0a52 for activity jakhar.aseem.diva/.MainActivity
02-14 15:32:24.433  3790  3852 I Finsky  : [143] pzi.apply(88): SCH: Scheduling system job Id: 9094, L: 14772, D: 15585658, C: false, I: false, N: 1
02-14 15:32:39.212  3790  3790 I Finsky  : [1] qsu.a(3): SCH: job service start with id 9094.
02-14 15:32:39.223  3790 11121 I Finsky  : [399] qji.a(5): SCH: Satisfied jobs for 9094 are: 12-1
02-14 15:32:39.563  3790 12399 I Finsky  : [408] qsq.a(-1): SCH: job service finished with id 9094.
02-14 15:45:22.237  9094  9110 D OpenGLRenderer: endAllActiveAnimators on 0xb6caa900 (RippleDrawable) with handle 0xb624b350
02-14 15:45:56.710  9094  9094 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
02-14 15:45:57.311  9094  9094 E diva-log: Error while processing transaction with credit card: 11
02-14 15:45:57.431  9094  9094 E diva-log: Error while processing transaction with credit card: 11
02-14 15:46:05.313  9094  9094 E diva-log: Error while processing transaction with credit card: 1154245
02-14 15:46:28.580  9094  9094 E diva-log: Error while processing transaction with credit card: 77868866
02-14 15:46:42.661  9094  9094 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
02-14 15:46:43.958  9094  9094 E diva-log: Error while processing transaction with credit card: 123456789

adb常用命令

1、获取所有包名

adb shell pm list packages

2、清除某个app的缓存

adb shell pm clear packageName

3、安装app

adb install -r apk的路径

4、查看设备

adb devices

5、关闭adb的后台进程

adb kill-server

6、启动adb的后台进程

adb start-server

7、让android脱离usb线的tcp连接⽅式

adb tcpip

8、连接开启了tcp连接⽅式的⼿机

adb connect

9、android⽇志查看

adb logcat

10、收集⽇志数据,⽤于后续的分析,⽐如耗电量

adb bugreport

11、从手机中拉取信息到本地电脑上

adb pull <手机路径> <本机路径>

12、 从本地电脑推送信息到手机上

adb push <本机路径> <手机路径>

13、把日志存储到某一个文件中

adb logcat -v time>testlog.txt
1、adb devices 查看手机设备
2、adb install packsge(包路径)安装包
3、adb install -r packages(保留数据及缓存文件安装新包)
4、adb uninstall package (卸载包)
5、adb kill-server 关闭adb服务
6、adb start-server 启动adb服务
7、adb shell pm list packages 查看手机里面所有包名
8、adb shell pm list packages -3查看手机里面所有第三方包名
9、adb shell /system/bin/screencap -p /sdcard/xx.png 截频并保存文件在手机上为xx.Png
10、adb pull /sdcard/xx.png D:/xx.png 将手机xx.png文件保存到D盘文件下
11、adb push D:/xx.text /adcard/xx.text 将电脑文件导入手机
12、adb shell pm clear com.ablesky.ui.activity 清除缓存数据
13、adb shell am start -n com.ablesky.ui.activity/com.ablesky.activity.SplashActivity 启动程序
14、adb shell am force-stop com.ablesky.simpleness.activity 强制停止运行程序
15、adb logcat 查看日志
16、adb logcat > D:\\log.txt 将日志打印到电脑上
17、netstat -aon|findstr "5037" 查看被占用端口对应的PID
18 tasklist /fi “PID eq PID号” 查看端口号对应的进程
19 taskkill /pid 2027 /f 杀掉某进程
20、adb shell monkey -p 包名 100   指定APP产生随机事件100
21、adb shell monkey -p 包名 -v -v 100   指定APP产生随机事件100次并发送详细的activity信息  

以上是关于adb工具的主要内容,如果未能解决你的问题,请参考以下文章

adb驱动和adb工具官方下载链接

mac安装adb工具

安卓开发测试小工具-adb

Android---adb命令

ADB调试工具

为啥我用ADB工具包不能用adb disable-verity这个命令