天天看點

常用ADB指令(一)

檢視adb版本: adb version

擷取裝置清單及裝置狀态: adb devices

核心日志:adb shell dmesg

解除安裝應用: adb uninstall [-k] <包命>

清除應用資料與緩存: adb shell pm clear <包名>

檢視詳細應用資訊: adb shell dumpsys package <>

檢視應用安裝路徑: adb shell pm path <>

強制停止應用: adb shell am force-stop <>

複制裝置裡的檔案到電腦上面:adb pull <> [電腦的目錄]

檢視裝置資訊:adb shell getprop ro.product.model

電池:adb shell dumpsys battery

分辨率:adb shell wm size

螢幕密度:adb shell wm density

顯示屏參數:adb shell dumpsys window displays

Android系統版本:adb shell getprop ro.build.version.release

ip位址:adb shell ifconfig | grep Mask

區域網路位址:adb shell ifconfig wlan0

Mac:adb shell cat /sys/class/net/wlan0/address

檢視CPU:adb shell cat /proc/cpuinfo

記憶體資訊:adb shell cat /proc/meminfo

啟動adb server: adb start-server

停止:adb kill-server

三種裝置狀态:

  • device , 裝置連接配接正常
  • offline , 裝置離線,連接配接出現異常
  • unauthorized 裝置為進行授權,需要在裝置上是否允許調試對話框進行授權

需擷取root的操作

  • adb shell pm list package 列出android裝置上的所有app
  • adb shell pm list package -s 列出android裝置上的系統級别app
  • adb shell pm list package -3 列出android裝置上的第三方app(使用者安裝的)
  • adb shell pm list package -f 列出app包名及對應的apk名及存放位置
  • adb shell pm list package -i 列出app包名及其安裝來源(應用市場名稱)
  • adb shell pm dump app包名 列出app的相關資訊,類似擷取Manifest檔案内容

啟動指定的包

adb shell am start -n 包名/類名

啟動預設浏覽器打開一個網頁

adb shell am start -a android.intent.action.VIEW -d http://testerhome.com

先停止目标應用,再啟動

adb shell am start -s com.android.camera/.Camera

啟動相機

adb shell am start -n com.android.camera/.Camera

啟動設定

adb shell am start -n com.android.settings/com.android.settings.Settings

啟動Wifi設定

adb shell am start -n com.android.settings/com.android.settings.wifi.WifiSettings

啟動藍牙設定

adb shell am start -n com.android.settings/com.android.settings.bluetooth.BluetoothSettings