android adb常用命令汇总

1、旋转屏幕

第一种方案:

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:3

其中最后 一个数字 为 0,1,2,3,用于控制旋转角度

第二种方案:

test adb shell
nanopc-t4:/ $ wm rotation 90
nanopc-t4:/ $ wm rotation 270
nanopc-t4:/ $ wm rotation 90
nanopc-t4:/ $ wm rotation 0

2、返回按键

adb shell input keyevent  4

3、打开/关闭应用

打开应用:

adb shell am start com.android.settings/.HWSettings

关闭应用:

adb shell am force-stop com.android.settings

4、android7.1打开adb wifi

1.配置build.prop
# adb pull  /system/build.prop
#添加
service.adb.tcp.port=5555
persist.service.adb.enable=1
 
重启Android设备即可.
 
2.连接设备
# adb connect 192.168.1.32:5555

5、edittext输入文本

adb shell input text 11111222222233333

6、清理数据

adb shell pm clear 包名

7、设置默认桌面

adb shell cmd package set-home-activity "baidu.robobus.my2/.MainActivity"

8、播放音乐

am start -n com.android.music/com.android.music.MediaPlaybackActivity -d /sdcard/Music/dongxi.mp3

9、查看运行时权限列表

 adb shell pm list permissions -d -g

10、 查看设备CPU架构

adb shell getprop ro.product.cpu.abi

11、查看cpu、gpu温度

CPU温度:
adb shell cat /sys/class/thermal/thermal_zone0/temp

GPU温度:
adb shell cat /sys/class/thermal/thermal_zone1/temp

12、设置android系统时间

命令格式:date MMddHHmmyyyy.ss set
举例: 
adb shell
date 100814192024.22 set

参考:https://www.cnblogs.com/tc310/p/10922464.html

13 UI相关

// 显示当前的window
adb shell dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值