android adb命令 android中adb命令最全总结
autofelix 人气:0想了解android中adb命令最全总结的相关内容吗,autofelix在本文为您仔细讲解android adb命令 的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:android,adb命令,下面大家一起来学习吧。
一、查看adb版本
adb version
C:\Users\Administrator>adb version Android Debug Bridge version 1.0.41 Version 30.0.4-6686687 Installed as E:\platform-tools\adb.exe
二、查看已经连接的设备
adb devices
C:\Users\Administrator>adb devices List of devices attached 127.0.0.1:7555 device
三、获取手机序列号
adb get-serialno
C:\Users\Administrator>adb get-serialno 127.0.0.1:7555
四、查看手机设别型号
adb shell getprop ro.product.model
C:\Users\Administrator>adb shell getprop ro.product.model Xiaomi
五、查看手机分辨率
adb shell wm size
C:\Users\Administrator>adb shell wm size Physical size: 1440x810
六、获取手机的mac地址
adb shell cat /sys/class/net/wlan0/address
C:\Users\Administrator>adb shell cat /sys/class/net/wlan0/address 08:00:27:7e:49:9c
七、查看日志
adb logcat
C:\Users\Administrator>adb logcat
八、查看电池信息
adb shell dumpsys battery
C:\Users\Administrator>adb shell dumpsys battery Current Battery Service state: AC powered: true USB powered: false Wireless powered: false Max charging current: 2000000 status: 2 health: 2 present: true level: 72 scale: 100 voltage: 4036 temperature: 326 technology: Li-poly
九、查看进程
adb shell ps
C:\Users\Administrator>adb shell ps USER PID PPID VSIZE RSS WCHAN PC NAME root 1 0 2732 1272 ep_poll 08126b35 S /init root 2 0 0 0 kthreadd 00000000 S kthreadd root 3 2 0 0 smpboot_th 00000000 S ksoftirqd/0 root 5 2 0 0 worker_thr 00000000 S kworker/0:0H
十、查看cpu使用情况
adb shell top
C:\Users\Administrator>adb shell top
十一、安装apk
- apk文件需要放到你命令执行的文件夹下,或者写上apk的绝对路径
- adb install [apk文件的路径]
C:\Users\Administrator>adb install douyin.apk Performing Push Install
- 多个设备安装apk
- adb -s [设备号] install [apk文件的路径]
C:\Users\Administrator>adb -s 127.0.0.1:7555 install douyin.apk Performing Push Install
- 如果apk已经存在,需要覆盖安装
- adb install -r [apk文件的路径]
C:\Users\Administrator>adb install -r douyin.apk Performing Push Install
十二、卸载apk
- 普通卸载
- adb uninstall [apk文件的路径]
C:\Users\Administrator>adb uninstall douyin.apk
- 卸载但是保留数据
- adb uninstall -k [apk文件的路径]
C:\Users\Administrator>adb uninstall -k douyin.apk
十三、查看手机上所有安装的app包名
adb shell pm list packages
C:\Users\Administrator>adb shell pm list packages package:com.rxgx.xx.ldzw package:com.tanwan.h5.xrxhj package:com.xinxin.mobile.dsfh package:com.xinxin.mobile.llwg package:com.android.providers.telephony package:com.xinxin.H5.jbdfhyc package:com.ss.android.ugc.aweme
十四、获取某个应用包名的启动入口
- adb shell dumpsys package com.ss.android.ugc.aweme | findstr activity
- com.ss.android.ugc.aweme/com.ss.android.sdk.activity.BootstrapActivity 这个就是抖音的启动入口
C:\Users\Administrator>adb shell dumpsys package com.ss.android.ugc.aweme | findstr activity ad29111 com.ss.android.ugc.aweme/com.ss.android.sdk.activity.BootstrapActivity
十五、启动某个app
adb shell am start -n [包名]/[启动入口]
C:\Users\Administrator>adb shell am start -n com.ss.android.ugc.aweme/com.ss.android.sdk.activity.BootstrapActi vity Starting: Intent { cmp=com.ss.android.ugc.aweme/com.ss.android.sdk.activity.BootstrapActivity }
十六、屏幕截图
adb shell screencap [保存路径]
C:\Users\Administrator>adb shell screencap /sdcard/screen.png
十七、录制视频
adb shell screenrecord [保存路径]
C:\Users\Administrator>adb shell screenrecord /sdcard/demo.mp4
十八、上传文件到手机
adb push 文件名 手机端SDCard路径
C:\Users\Administrator>adb push douyin.apk sdcard/douyin.apk
十九、从手机端下载文件
adb pull [手机上文件路径]
C:\Users\Administrator>adb pull sdcard/douyin.apk
二十、模拟屏幕点击事件
adb shell input tap x坐标轴 y坐标轴
C:\Users\Administrator>adb shell input tap 500 1450
二十一、模拟手势滑动事件
adb shell input swipe 开始x轴 开始y轴 结束x轴 结束y轴 过程持续时间毫秒
C:\Users\Administrator>adb shell input swipe 100 500 100 1450 100
二十二、模拟点按键盘按钮
adb shell input keyevent [key值]
C:\Users\Administrator>adb shell input keyevent 25
二十三、向屏幕输入一些信息
- db shell input text [字符串信息]
- %s是空格
C:\Users\Administrator>db shell input text "insert%stext%shere"
二十四、发送广播
adb shell am broadcast -a "broadcastactionfilter"
C:\Users\Administrator>adb shell am broadcast -a "broadcastactionfilter"
二十五、使用自带浏览器打开网页
adb shell am start -a [浏览器包名] -d [网址]
C:\Users\Administrator>adb shell am start -a "android.intent.action.VIEW" -d https://www.google.com
二十六、获取手机root权限
adb vivoroot
C:\Users\Administrator>adb vivoroot
二十七、连接不稳定时需要挂载
adb remount
C:\Users\Administrator>adb remount
二十八、重启手机
正常重启
C:\Users\Administrator>adb reboot
重启手机到recovery
C:\Users\Administrator>adb reboot recovery
重启到bootloader界面
C:\Users\Administrator>adb reboot bootloader
二十九、关闭adb服务
C:\Users\Administrator>adb kill-server
三十、启动adb服务
C:\Users\Administrator>adb start-server
加载全部内容