Some of the more practical Android adb commands to share _android

Source: Internet
Author: User

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:

ADB devices

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:

ADB shell

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:

ADB logcat

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:

ADB logcat-c

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.