学习笔记——常用指令

adb 常用命令使用指南,希望对你有帮助
1、 adb devices 查看设备列表
查看电脑已连接Android 设备列表,多行显示表示连接多个Android设备,每行前面的字符串表示Android设备的SN号
2、adb get-state 获取连接状态 device offline unkown
3、adb install -r APK路径 安装应用
apk文件所在的文件路径,包括apk,如D:/hello.apk,注意需要打开的cmd路径不要带有中文,否则,部分电脑可能会提示安装失败
4、adb uninstall 应用包名,应用卸载 查看自己安装的包名,adb uninstall -k hello.apk 下载应用,但保留缓存数据
5、adb connect 设备ip地址,如果电脑与设备在同一局域网内,Android设备的连接ip 地址,可连接成功
6、adb push 电脑上的文件 路径 sdcard/ 将电脑的文件输入到手机上
如文件D:/hello.apk, adb push D:/hello.apk /sdcard、hello.apk
7、adb pull /sdcard/文件路径 指定的pc目录,将文件拷贝到pc,文件保存的路径直接与cmd打开的路径相同
8、adb reboot 或加参数-p设备进行重启
9、 adb shell pm clear 包名 清除应用数据
10 、adb shell pm list packages -3 查看第三方安装的应用包名,卸载应用前,一般可通过该指令查看包
11、adb shell am force-stop 包名 关闭应用
12、adb shell screencap /sdcard/screen.png 截屏幕
13、adb shell screenrecord /sdcard/hello.mp4 屏幕视频录制,测试时可使用
14、adb logcat 抓取日志
如果要过滤日志,可通过adb logcat | findstr “输入过滤的内容”
15、adb shell wm size 查看屏幕大小
16、 adb shell getprop查看配置信息
如:adb shell getprop ro.build.version.sdk 查看api版本
17、adb shell input keyevent 4 相当于返回键,返回上一页
18、adb shell df 查看手机存储信息
19、adb shell pm disable-user com.android.launcher3 禁用系统应用
20、 adb shell pm enable com.android.launcher3 启用系统 ,需要root权限
21、adb start-server | kill-server //启动或关闭adb服务进程
22、adb shell cat /sys/class/net/wlan0/address //获取mac地址
23、adb shell monkey -p 包名 --throttle 100 --ignore-crashes --ignore-timeouts --ignore-security-exceptions --ignore-native-crashes --monitor-native-crashes -v -v -v –s 1540475754297 100 monkey测试
24、adb shell ls /system/bin 查看当前设备可以使用的所有命令
25、adb shell input text “www.baidu.com”,在编辑的文本框中输入编辑文字
26、adb shell svc wifi enable | disable 打开或关闭wifi
27、adb shell svc data enable |disable 打开或关闭移动网络
28、adb shell input swipe 760 500 600 320 点击屏幕,根据实际坐标点击
29、adb shell mkdir /sdcard/创建目录
30、cat /proc/cpuinfo // 查看CPU信息,如果为内存,则cat/proc/meminfo
31、cat /data/misc/wifi/.conf 查看wifi密码,需要root权限
32、 mount -o remount,rw / 当root权限之后,仍提示file system read only时,先执行adb root ,接着执行adb remount, mount -o remount,rw / 然后执行该指令
33、(1)setprop service.adb.tcp.port 5555 (2)stop adbd (3)start adbd 使用wifi连接失败时,
34、adb shell dumpsys activity | findstr “mFocus” 获取当前的activity
35、adb shell settings put global policy_control immersive.full=

36、仅隐藏状态栏:adb shell settings put global policy_control immersive.status=*
37、仅隐藏虚拟键:adb shell settings put global policy_control immersive.navigation=*
38、恢复:adb shell settings put global policy_control null
39、完全隐藏 adb shell wm overscan 0,0,0,0
40、旋转屏幕
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1

svc命令记录

svc主要功能集
Available commands:
help     Show information about the subcommands
power    Control the power manager
data     Control mobile data connectivity
wifi     Control the Wi-Fi manager
usb      Control Usb state
nfc      Control NFC functions
  1. 控制屏幕
    屏幕常亮:svc power stayon true
    屏幕不常亮: svc power stayon false
    插入USB时常亮: svc power stayon usb
    插充电器是常亮: svc power stayon ac
  2. 打开关闭数据流量
    打开数据流量:svc data enable
    关闭数据流量:svc data disable
  3. 打开关闭wifi
    打开wifi:svc wifi enable
    关闭wifi:svc wifi disable
  4. 控制USB连接方式
    切换连接方式:svc usb setFunctions [function]
    [function]可选项: ‘mtp’, ‘ptp’, ‘rndis’, ‘midi’
  5. 打开关闭nfc
    打开nfc:svc nfc enable
    关闭nfc:svc nfc disable
  6. 打开关闭bluetooth
    打开蓝牙:svc bluetooth enable
    关闭蓝牙:svc bluetooth disable
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值