Here are some of the ADB's useful commands that I found on Android. You can manually or use the automated build and test process.
View Device
Copy Code code as follows:
Connect to a target device using the use Adb-s device_id if multiple device connections
Installation Application
Install a APK package using the Install command, and reinstall and maintain the original application data using-R if the application is installed on the device
Copy Code code as follows:
ADB install-r Apk_file
#example
ADB install-r COM.FEILIU.WJBD
Uninstall an application
Copy Code code as follows:
ADB uninstall Apk_file
#example
ADB uninstall COM.FEILIU.WJBD
Start a page
Copy Code code as follows:
ADB shell am Start package_name/activity_in_package
ADB shell am Start package_name/fully_qualified_activity
# example
ADB shell am start-n com.feiliu.wjbd/. Mainactivity
ADB shell am start-n com.feiliu.wjbd/com.feiliu.wjbd.mainactivity
Enter the shell interface of the device
Copy Code code as follows:
Screen Cutting
Sergei Shvetsov came up with a good way to get a screenshot and use the shell screencap to print to the local directory via Perl. Detailed view of the explanation given by his blog
Copy Code code as follows:
ADB Shell Screencap-p | Perl-pe ' s/\x0d\x0a/\x0a/g ' > Screen.png
Jie Shi
This command will send a screen event to the device on the lock screen
Copy Code code as follows:
ADB shell Input KeyEvent 82
Log
Command line display log
Copy Code code as follows:
According to TagName Filtration
Copy Code code as follows:
ADB logcat-s tag_name
ADB logcat-s tag_name_1 tag_name_2
#example
ADB logcat-s TEST
ADB logcat-s TEST MYAPP
Priority filtration
Displays a specific priority warning and the above log.
Copy Code code as follows:
ADB logcat "*:P riority"
# example
ADB logcat "*:w"
Priority level:
V-Rules (lowest priority)
D-Debugging
I-Information
W Warning
E-Error
F-Fatal
S-Silent (highest priority, no information will be printed)
Using grep filtering
This is much like using a pipe command on Linux, which requires system support
Copy Code code as follows:
ADB Logcat | grep "Search_term"
ADB Logcat | grep "search_term_1\| Search_term_2 "
#example
ADB Logcat | grep "Exception"
ADB Logcat | grep "exception\| Error "
Clear Log Block
Use to purge old logs
Copy Code code as follows: