Android common adb command summary

  1. Connect Android device: adb connect [ip] 
  2. View all connected devices: adb devices 
  3. Get the Android system version: adb shell getprop ro.build.version.release
  4. Enter the Android system settings: adb shell am start com.android.settings/com.android.settings.Settings
  5. Stop the adb service: adb kill-server

related to app

  1. Install the application: adb install -r [apk file path] (-r means mandatory installation)
  2. Uninstall the application directly: adb uninstall [apk package name]  
  3. Uninstall app but keep data and cache files: adb uninstall -k [apk package name]
  4. Check the package name: aapt dump badging [apk file path] | findstr package (use "findstr" for windows, "grep" for linux)
  5. Check launchable-activity: aapt dump badging [apk file path]| findstr launchable-activity
  6. Clear app cache: adb shell pm clear [package name]
  7. Kill the app process: adb shell am force-stop [package name]
  8. Get device logs: adb logcat >[file save path] (if multiple devices are connected, then adb -s [ip] logcat )
  9. Get a single application log: adb logcat |find "[apk package name]" >[file save path]
  10. Check the startup time of an application: adb shell am start -W -n [package name]/[launchable-activity]

CPU related

  1. Get the number of CPU cores: adb shell cat /sys/devices/system/cpu/possible
  2. Get the highest operating frequency of a CPU:
    adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq (cpu0 can be changed to [0-the highest number of cores]
  3. Check the overall usage of all processes: adb shell top
  4. View the detailed cpu usage of each application: adb shell dumpsys cpuinfo
  5. View the number of threads of a process: adb shell cat /proc/[pid]/status | findstr Threads 
  6. Turn off the service of a process: adb shell pm disable [package name]

memory related

  1. Obtain the overall memory data of the device: adb shell cat /proc/meminfo
  2. Get the memory details of the entire system: adb shell dumpsys meminfo (following +[pkg or pid], you can get the detailed occupancy of a single application)
  3. Get the pss/vss/rss/uss memory usage of the device: adb shell procrank (requires root authority)
  4. The initial heap memory allocated after the application starts: adb shell "getprop|grep dalvik.vm.heapstartsize"
  5. Maximum heap memory limit for a single application: adb shell "getprop|grep heapgrowthlimit"
  6. The maximum heap memory limit of a single java virtual machine: adb shell "getprop|grep dalvik.vm.heapsize"

View device temperature:

adb shell

cat sys/class/thermal/thermal_zone0/temp

View battery information

adb shell dumpsys battery

おすすめ

転載: blog.csdn.net/qq_38571773/article/details/127647961
おすすめ