Android's ADB learning notes

Source: Internet
Author: User

Common commands for 1.ADB

Pull command: adb-e|-d. {file path} {get file path}

2. Basic commands for file operations

ls-al: Displays user permissions on files under the current directory. = La-alMount use failed/dev/block/mtdblock0/system

3. Information query Related commands

Bugreport: When the application crashes, use this command to view the relevant information
Logcat: Application layer cache information, generally look for a problem to see this log
DUMPSYS:ADB-E The use of the shell Dumpsys Cpuinfo CPU (cpuinfo)
ProcessName Package Name
key Information: What buttons to press or lift adb-e/-d shell getevent is useful when testing a touchscreen
System Properties Set System Properties: used in the root environment, mainly for debugging
Top command: If the default input ADB-E Shell top will update CPU information every 3 seconds
-M selects the application CPU usage information before the top m bar
Query Package Name: ADB-E Shell pm List Packages

4. Operating phone-related commands

\

Scenario for the KILL command:
Open monkey:adb Shell monkey-p com.android.browser--throttle 200 500000 (500,000 times for your own browser) For example, when using the monkey Test phone, monkey tested Process in order to stop monkey, do not need to directly force off the phone, just query kill monkey process can be. (1) query monkey process adb Shell PS | Find "Monkey" get: Root 2283 2282 124092 18392 ffffffff b7f49a45 S com.android.commands.monkey (2) Kill monkey process adb shell K Ill 2283
Example: adb Shell svc data enable|disable (link to control data traffic)
am: Use the AM command to open the app and need to know the activity name of the app. For example, open a browser app. Open the browser first, then run the ADB-E Shell Dumpsys activity | Find "MF" query site information after you close the browser, use the command >>adb-e Shell am start-n com.android.browser/. Browseractivity Open Browser

5. Test-use-related commands

Iftop command: Send and transmit the network transmission situation, but requires root privileges, otherwise it is not displayed.

Netstat: You can query network information such as IP.

Screenrecord: Can record the screen video 3mins

    • Support Android4.4 (API level 19) above
    • Supported video formats: MP4

screencap:adb-e|-d Shell screencap {Save file path}

The input command is useful for automated testing using ADB.

Sub-command Usage
Text Enter text
KeyEvent Key information (number and name)
Tap Click
Swipe Sliding
Press Press
Roll Rolling

One of the KeyEvent key code lists can be found in the following blog:

Http://www.cnblogs.com/shipengzhi/articles/2035010.html

Android's ADB learning notes

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.