- Connect Android device: adb connect [ip]
- View all connected devices: adb devices
- Get the Android system version: adb shell getprop ro.build.version.release
- Enter the Android system settings: adb shell am start com.android.settings/com.android.settings.Settings
- Stop the adb service: adb kill-server
related to app
- Install the application: adb install -r [apk file path] (-r means mandatory installation)
- Uninstall the application directly: adb uninstall [apk package name]
- Uninstall app but keep data and cache files: adb uninstall -k [apk package name]
- Check the package name: aapt dump badging [apk file path] | findstr package (use "findstr" for windows, "grep" for linux)
- Check launchable-activity: aapt dump badging [apk file path]| findstr launchable-activity
- Clear app cache: adb shell pm clear [package name]
- Kill the app process: adb shell am force-stop [package name]
- Get device logs: adb logcat >[file save path] (if multiple devices are connected, then adb -s [ip] logcat )
- Get a single application log: adb logcat |find "[apk package name]" >[file save path]
- Check the startup time of an application: adb shell am start -W -n [package name]/[launchable-activity]
CPU related
- Get the number of CPU cores: adb shell cat /sys/devices/system/cpu/possible
- 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] - Check the overall usage of all processes: adb shell top
- View the detailed cpu usage of each application: adb shell dumpsys cpuinfo
- View the number of threads of a process: adb shell cat /proc/[pid]/status | findstr Threads
- Turn off the service of a process: adb shell pm disable [package name]
memory related
- Obtain the overall memory data of the device: adb shell cat /proc/meminfo
- 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)
- Get the pss/vss/rss/uss memory usage of the device: adb shell procrank (requires root authority)
- The initial heap memory allocated after the application starts: adb shell "getprop|grep dalvik.vm.heapstartsize"
- Maximum heap memory limit for a single application: adb shell "getprop|grep heapgrowthlimit"
- 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