1. Instruction
Screencap/mnt/sdcard/1234.png
2. Resolution Acquisition
adb shell Dumpsys window displays or adb shell Dumpsys window
Results such as: init=1080x1920 480dpi cur=1080x1920 app=1080x1920 rng=1080x1005-1920x1845 (need to be super-searched)
3. Get the current app's package and activity name (Python 2.7 required)
A, applicable to the following version 4.2
I=os.popen (' adb shell dumpsys activity '). Read (). Split (' Running activit ') [1].split ('} ') [1].split (') [-1]
b, applicable to more than 4.1 version
I=os.popen ("adb Shell Dumpsys Input | Findstr focusedapplication "). Read (). Split () [5]
4, Monitoring the memory consumption of an application
adb shell Dumpsys meminfo packagename
5. Monitor CPU Usage
ADB Shell Dumpsys Cpuinfo
6. Get all Package names
ADB shell PM List Packages
7. Get the System app package name
ADB shell PM List packages-s
8. Get the third-party app package name
ADB shell PM List packages-3
9. Get the application installation package path corresponding to the package name
ADB shell pm List packages-f PackageName all applications
ADB shell PM List packages-3-F packagename third-party applications
ADB shell PM List packages-s-F packagename System Application
10. Clear Application Data
ADB shell pm Clear PackageName
11. Close the application
Am Force-stop PackageName
12. Send Broadcast
AM broadcast [options] <INTENT>
such as: adb shell am Broadcast-a "action_finish" (send a broadcast to close an activity)
ADB shell am broadcast-a Android.intent.action.MASTER_CLEAR (Factory reset method that clears all memory contents)
13. View the size of the folder space
Du-c-K View the size of all files under the path and calculate the sum, in kilobytes
14, waiting for the ADB device access (no device when the plug process, the device will return a null value)
ADB wait-for-device
15. Filter Output
linux:| grep xxx
DOS: | findstr xxx or | Findstr "XXXX"
16. Log Record
Logcat-d Log for some time before printing, auto exit Logcat
Logcat *:e Print only log above e-level (e replaceable)
Logcat-s XXX only filter out the XXX related log
Logcat-f redirect log output (e.g. to file), similar to ">>", but better than ">>" compatibility
17. Self-contained control method
Input KeyEvent <key code number or name> executes a key command, such as "adb shell input keyevent keycode_power" or "adb shell input KeyEvent 26 "
Input tap <x> <y> execute a click command, such as "adb shell input tap 800 800"
Input swipe <x1> <y1> <x2> <y2> perform sliding instructions
Input text "text content" type, need focus first, cannot have space
Am Start Pack Package name/Activity name launch app
ADB shell am Start--activity-single-top-n Package name/activity name toggle the active Name page of the app that was launched
ADB shell am START-W-N Package name/activity name launch app and calculate startup time
18. Get files from Android
ADB pull <remote> <local>
19. write files to Android
ADB push <local> <remote>
20. Install the App
ADB install path/xxx.apk
-R Forced installation
-S mount to SDcard (some phones are not available)
21. Uninstall App
ADB uninstall PackageName
22. Delete Files
RM path/xxx
23. Delete Folder
Rm-r Path
24. Create a file
> path/xxx
Touch path/xxx
25. Create a Folder
mkdir Path
Android Shell Common Command collation