Go Handy adb commands for Android

Source: Internet
Author: User

Transferred from: http://www.growingwiththeweb.com/2014/01/handy-adb-commands-for-android.html

View connected device (s)

Use the To view all connected devices and list their IDs.

ADB devices

If multiple devices is attached, use to adb -s DEVICE_ID target a specific device.

Install an application

Use install the command to install an APK, the optional -r argument reinstalls and keeps any data if the application is a Lready installed on the device.

Install -install -R ~/application.apk
Uninstall an application
ADB uninstall package_name# exampleadb Uninstall Com.growingwiththeweb.example
Start an activity
ADB shell am start package_name/activity_in_packageadb shell am start package_name/-N com.growingwiththeweb.example/-N com.growingwiththeweb.example/ Com.growingwiththeweb.example.MainActivity
Entering the device ' s shell
ADB shell
Take a screenshot

Sergei Shvetsov came up with a nice one liner so takes a screenshot with and shell screencap outputs it to a local directory using Perl. Checkouthis Blog for an explanation.

Perl ' s/\x0d\x0a/\x0a/g ' > Screen.png
Power button

This command sends the power button event to turn the device on or off.

26
Unlock screen

This command sends the event, unlocks the lockscreen on the device. It can be combine with the power button command above to turn on and unlock the device.

82
Print all installed Packages
ADB shell PM List packages-f
Logging

To show the log stream on your command line.

ADB logcat
Filter by TagName
ADB logcat---s TEST MYAPP
Filter by priority

To show logs of a specific priority warning and above.

" *:P riority "  "*:w"

Here is the priority levels:

    • V-Verbose (Lowest priority)
    • D-Debug
    • I-Info
    • W-Warning
    • E-Error
    • F-Fatal
    • S-Silent (highest priority, on which nothing is ever printed)
Filter by TagName and priority
ADB logcat--s Test:w
Filter using grep

Alternatively the output of logcat can is piped to on grep a system that supports it.

grep " Search_term "  grep"search_term_1\| Search_term_2"grep"Exception "  grep " exception\| Error"
Clearing the logcatBuffer

Use the-to-clear the buffer to remove any old log data.

ADB logcat-c
Further reading

See more details on the official adb reference site.

Go Handy adb commands for Android

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.