关于ADB工具的使用
驱动安装
1. 安装驱动
2. 配置环境变量
变量名:ANDROID_HMOE
变量值:D:\1.0.40 //也就是ADB的路径
3. 在Path中添加一行%ANDROID_HMOE%,点击保存即可
4. 验证是否成功,打开win+R 输入CMD 执行一下 adb version,如果成功则显示版本号
C:\Users\guoqi\Desktop>adb version
Android Debug Bridge version 1.0.40
Version 30.0.5-6877874
Installed as D:\platform-tools\adb.exe
ADB常用命令
adb devices //查看当前连接的设备
adb root //获取root权限
adb remount //将system分区重新挂载为可读写分区
adb shell mount -o remount rw /misc //挂载misc分区
adb shell sync //确保写到flash中,把内存缓冲区的数据写进磁盘
adb shell reboot //重启设备
adb shell rm -rf /system/app/.apk //强制删除.apk文件
adb push 文件 /misc
//将文件复制到设备的misc文件夹
adb pull //从设备复制文件到本地
adb shell cat /sys/class/net/wlan0/address //查看本机MAC地址
adb shell ifconfig eth0 //查看本机IP地址
adb shell ifconfig wlan0 // //查看本机IP地址
adb -s // cmd向设备发送adb命令 多台设备
adb install -r C:\Users\fyd-guo\Desktop\ejgg_24_debug_new.apk //强制安装APK
adb shell chmod 777 /system/fonts/1111.ttf //设置文件夹权限
adb shell cat /data/misc/wifi/*.conf //查看wifi密码
adb shell dumpsys window | findstr mCurrentFocus //查看正在运行的包名
adb uninstall com.example.lty.ad // 卸载app
adb kill-server //关闭ADB服务
adb start-server //启动ADB服务
netstat -ano | findstr “5037” //查看“5073”端口信息
TASKLIST | findstr “4236” //查看PID“4236”进程
adb shell svc wifi disable //关闭wifi
adb shell svc wifi enable //打开wifi (adb root; adb remount)
adb logcat | grep Wifi //查看WIFIlog信息 可以加PID进程号
adb logcat | find “com.example.lty.ad” //查看指定包名的log
ADSH包名 com.example.lty.cs
com.doterm.smarttable WEADS包名
adb shell dumpsys package com.example.lty.cs | findstr versionName //查看APP版本号
adb shell pm dump com.example.lty.ad | findstr version //查看APP版本号
adb shell dmesg > /sdcard/dmesg_20210428.txt
adb pull /sdcard/dmesg_20210428.txt d:
adb shell settings put global policy_control null //显示虚拟按键栏
adb shell input keyevent 3 //home键
adb shell input text abc //输入abc
adb shell pm path com.google.android.gms //查看APK路径
wm size 查看分辨率
wm size 1920x1280 修改分辨率
adb shell screencap -p /sdcard/01.png //截屏
adb pull /sdcard/01.png //保存截屏
adb shell service call iphonesubinfo 1 // 查看IMEI
wm density 查看dpi
wm density 240 修改dpi
wm size reset 恢复默认dpi
adb shell input swipe 500 500 30 500 触摸滑屏
//模拟点击(540, 1104)坐标
adb shell input tap 540 1104
adb shell dumpsys meminfo 查看内存情况
adb logcat -v threadtime > log.txt 保存到本地
adb shell monkey --pkg-blacklist-file /data/blacklist.txt -v -v --throttle 200 1000000 // monkey测试,指定黑名单。
getevent //获取点击事件
adb shell pm clear com.doterm.smarttable //清理APP数据,后面是包名
adb root
adb remount
adb shell
cd sys/class/gpio
echo 52 > export
adb shell am start com.example.lty.cs/com.example.lty.cs.activity.MainActivity 启动APP
com.doterm.smarttable/com.simpo.smarttable.activity.NewMainActivity
adb connect 192.168.1.124:5555 连接设备
cd gpio52
echo out > direction
echo 1 > value
获取系统版本:adb shell getprop ro.build.version.release
获取系统api版本:adb shell getprop ro.build.version.sdk
adb shell rm -rf /sdcard/ADSResources/VerTicalScrennAD/* //删除广告文件
adb uninstall com.example.lty.ad 卸载广告app
查看webview 版本:adb shell am start -a android.intent.action.VIEW -d https://liulanmi.com/labs/core.html
868 webview 52.0.2743.100 2016.7-2016.8