ADB命令行调试工具

ADB命令行调试工具
Android 调试桥 adb是的命令行设备通信工具。
1、windows端下载
https://developer.android.google.cn/studio/releases/platform-tools
https://dl.google.com/android/repository/platform-tools_r31.0.1-windows.zip
2、linux下载
https://dl.google.com/android/repository/platform-tools_r31.0.1-linux.zip
3、常用命令
adb 连接断开
adb kill-server
查询设备
adb devices
文件复制
adb push test.txt /sdcard/test.txt
adb push /sdcard/test.txt test.txt
启动服务
adb start-server
连接状态
adb get-state
停止服务
adb kill-server
交互式命令
adb shell ls /system/bin
获取root权限
adb root
连接后可以使用大部分命令行 ls cd cp cat等
连接网络
adb connect 192.168.1.110:5555
列出应用包
adb shell pm list package
安装apk
adb shell pm install **.apk
3. 卸载软件   
adb uninstall com.XXX.XX.apk
结束应用
adb shell am force-stop 包名
重新挂载系统分区用于读写
adb shell mount -o remunt -o rw /system
分析信息
adb shell dumpsys -l
模拟按键
adb shell input keyevent + 按键事件 26 (PowerKey) ,具体网上查
adb shell input keyevent 26
触摸事件
adb shell input tap 500 500
滑动事件 如:从右往左滑动屏幕
adb shell input swipe 800 600 100 600
windows批处理
.bat
adb shell input 26
adb shell input 26
linux 批处理
如果手机已经root 可以把文件写入手机运行测试
.sh
input keyevent 26
input keyevent 26
下面有一个定时点击例子可参考。```

#!/system/bin/sh
##click```
function gogo()
 {
    
    
 sleep $(($(($RANDOM%37))+1))
 input keyevent 224
 am start -n com.xxx/xxxx.LoadingActivity
 sleep 8
 input tap 360 840
 sleep 6
 input tap 360 300
 sleep 5
 input tap 360 750
 sleep 5
 am force-stop com.xxxx.xxxx
 sleep 2
}
##
##click three times
function test_click()
{
    
    
    yx_min=1
    yx_max=4
    yx_minute=35
    cur_minute=$(date +%M)
    sleep 2
    if [ $cur_minute -ge $yx_min ]  && [ $cur_minute -le $yx_max ]
    then
    gogo
    fi
}
##
##do while
while :
do 
    sleep 6
    cur_hour=$(date +%H)
    if [ $cur_hour -eq 20 ] || [ $cur_hour -eq 7 ]
    then
    test_click
    else sleep 3
    fi
done
##

猜你喜欢

转载自blog.csdn.net/lenovo8088/article/details/115212762