Android 车载 ADB 常用命令

526 阅读2分钟
  1. adb 命令
adb shell 
cd system/priv-app/ALLauncher
# 删除备份文件
rm -rf oat 

exit

# 在当前文件夹下推送文件到设备
adb push ALLauncher.apk system/priv-app/ALLauncher
# 刷新同步
adb shell sync
# 重启
adb reboot

exit

# 开启最高权限
adb root
# 重新挂载 system 分区
adb remount

----------------------

查看 log 日志

adb shell 
logcat -c
logcat | grep "CarjAudioFocus"

adb launcher 安装不上

查看 launcher 目录位置:

  • pm path com.autolink.launcher
PS C:\Users\EDY> adb root
adbd is already running as root
PS C:\Users\EDY> adb remount
remount succeeded
PS C:\Users\EDY> adb shell
cheryidc:/ # cd system/priv-app/ALLauncher/
cheryidc:/system/priv-app/ALLauncher # ls
ALLauncher.apk  oat
cheryidc:/system/priv-app/ALLauncher # rm -rf oat
cheryidc:/system/priv-app/ALLauncher # ls
ALLauncher1.apk
cheryidc:/system/priv-app/ALLauncher # rm -rf ALLauncher1.apk
cheryidc:/system/priv-app/ALLauncher # ls
cheryidc:/system/priv-app/ALLauncher # sync
cheryidc:/system/priv-app/ALLauncher # reboot
PS C:\Users\EDY> adb shell

查看当前运行中的 Activity

  • PS C:\Users\EDY> adb shell
  • cheryidc:/ # dumpsys activity activities | grep mResumedActivity

杀死进程,重启

  • cheryidc:/ # ps -A | grep launcher
  • system 28489 374 16401032 203828 do_epoll_wait 0 S com.autolink.launcher
  • cheryidc:/ # kill 28489

查看 分辨率和密度

  • adb shell wm size
  • adb shell wm density

root + remount

  • adb root && adb wait-for-device && adb remount

查看栈顶 activity

  • adb shell dumpsys window | findstr mCurrentFocus
  • logcat -b all | grep -Ei "wm_.*launcher|Start u0"

开启布局边界 : 重新运行(不能重启,重启会重置)

adb shell setprop debug.layout true

终端查看 log 日志

  • adb shell
  • logcat -c
  • logcat -s DEBUG

查看CPU使用情况

adb shell top -n 1

查看 app 版本信息

adb shell dumpsys package fengniao.app.market | findstr version

查看台架 ip

adb shell "ifconfig | grep -A 3 wlan"

Error running 'app' Couldn't terminate previous instance of app

遇到应用程序无法终止上一个实例的解决方案

PS C:\Users\EDY> adb reboot
PS C:\Users\EDY> adb root
restarting adbd as root
PS C:\Users\EDY> adb remount
remount succeeded

当 adb 挂载成功后,在 AS 中 Run

重置 launcher 桌面

PS C:\Users\EDY> adb shell pm clear com.autolink.launcher

拉起 launcher 桌面

PS C:\Users\EDY> adb shell am start com.autolink.launcher

adb 连接设备

  • 查看连接设备:adb device
  • 设置端口号:adb tcpip 8888
  • 设备的 IP + 端口:adb connect 10.30.80.170:8888

设置属性

  • 超速报警:adb shell setprop persist.vendor.oem.cfg.cc.ihu.overspeed.alarm.function 1
  • 是否显示dab:adb shell setprop persist.vendor.oem.cfg.cc.ihu.dab.digital.radio 1

adb 主题模式广播

  • adb shell am broadcast -a "com.autolink.test" --ei value 0 白天
  • adb shell am broadcast -a "com.autolink.test" --ei value 1 黑天

SystemUI

C:\Users\EDY>adb shell pidof com.android.systemui
1434

C:\Users\EDY>adb root && adb remount
restarting adbd as root
adbremount succeeded

C:\Users\EDY>adb shell kill 1434

二驱和四驱

# 0 二驱, 1 四驱
adb shell getprop persist.vendor.oem.cfg.cc.icm.drive.type

adb shell setprop persist.vendor.oem.cfg.cc.icm.drive.type 1

方控调节音量

adb shell am broadcast -a com.autolink.hardkey.action.TESTKEY --ei code 510 --ei action 0

adb shell am broadcast -a com.autolink.hardkey.action.TESTKEY --ei code 510 --ei action 1

唤起语音

adb shell am broadcast -a com.autolink.hardkey.action.TESTKEY --ei code 508 --ei action 0&&adb shell am broadcast -a com.autolink.hardkey.action.TESTKEY --ei code 508 --ei action 1