Android common adb shell commands (GO)

Source: Internet
Author: User

Debugging Android program sometimes requires adb shell command, ADB full name Android Debug Bridge, is to play the role of the Debug bridge.

With ADB we can debug the Android program via DDMS in Eclipse, which is the Debug tool. ADB communicates with the IDE and QEMU by listening to ports such as socket TCP 5554.

By default, the ADB process runs automatically when we run eclipse. ADB is a C/S mode program consisting of three parts: a client,a server and a daemon.

Where client and server are running on the development machine, daemon runs on emulator or device.
ADB is typically located in the <sdk>/platform-tools/ directory, where <sdk> is the installation directory for the Android SDK. You can add the ADB path into the system environment variable path,

Example: D:\sdk\platform-tools, so that you can open PowerShell when you can respond to the ADB command, do not have to enter the ADB directory every time. The following are common ADB commands

The common Command Encyclopedia of ADB

1. Display all Android platforms in the system:

Android list targets

2. Display all AVD (simulator) in the system:

Android List AVD

3. Create an AVD (simulator):

Android Create AVD--name name--target platform number

4. Start the emulator:

EMULATOR-AVD name-sdcard ~/name. IMG (-skin 1280x800)

5. Delete the AVD (simulator):

Android Delete AVD--name name

6. Create SDcard:

Mksdcard 1024M ~/name. img

7. AVD (simulator) Location:

Linux (~/.ANDROID/AVD) Windows (C:\Documents and SETTINGS\ADMINISTRATOR\.ANDROID\AVD)

8. Start Ddms:

Ddms

9. Displays all the emulators currently running:

ADB devices

10. Execute a command on a simulator:

Abd-s Simulator number Command

11. Install the application:

ADB install-r application. apk

12. Get the files in the emulator:

ADB pull <remote> <local>

13. Write the file to the emulator:

ADB push <local> <remote>

14. Enter the shell mode of the simulator:

ADB shell

15. Launch the SDK, documentation, instance download Manager:

Android

16. Unloading APK Package:

ADB shell

CD Data/app

RM APK Package

Exit

The main package name of the ADB uninstall APK package

ADB install-r APK Package

17. View the ADB command Help information:

ADB Help

18. View the log information on the command line:

ADB logcat-s label Signature

The commands behind the ADB shell come mainly from:

SOURCE \system\core\toolbox directory and source code \FRAMEWORKS\BASE\CMDS directory.

20. Remove the System application:

ADB remount (re-mount the system partition so that the system partition is re-writable).

ADB shell

CD System/app

RM *.apk

21. Get Administrator Privileges:

ADB root

22. Start activity:

ADB shell am START-N package Name/package name + class name (-N class name,-a action,-d date,-m mime-type,-c category,-e Extended data, etc.).

23. Release Port:

You can set any port number as the request port for the host to the emulator or device. Such as:
ADB forward tcp:5555 tcp:8000

24. Copy files:

You can copy files to a device or from a device,
To copy a file or directory to a device or emulator:
ADB push <source> <destination></destination></source>
such as: adb push test.txt/tmp/test.txt
To copy a file or directory from a device or emulator:
ADB pull <source> <destination></destination></source>
such as: ADB pull/addroid/lib/libwebcore.so.

25, the Search simulator/device instance:

Gets a list of instances of the currently running emulator/device and the status of each instance:
ADB devices

26. Check the bug report:
ADB bugreport
27. Record the wireless communication log:

Generally speaking, the wireless communication log is very many, at run time not necessary to record, but we can still through the command, set the record:
ADB shell
Logcat-b Radio

28. Get the ID and serial number of the device:

ADB get-product
ADB Get-serialno

29. Accessing the database SQLite3

ADB shell
Sqlite3

30.CD system/sd/data//Enter the specified folder within the system

31.LS//list displays the contents of the current folder

32.rm-r XXX//Delete the folder with the name xxx and all the files inside it

33.rm XXX//delete file xxx

34.rmdir xxx//delete xxx folder

Android common adb shell commands (GO)

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.