How to use the Android Debug Bridge (ADB)

Source: Internet
Author: User
Tags port number

Android System Debugging Tools--ADB

The Android Debug Bridge is a versatile tool to manage the performance on your device.
That is, the ADB is a tool for managing emulators.

Includes the following three sections:

Client: Run on the development environment, or execute the ADB command through the command-line-mode shell interface to manipulate the client program. Other Android tools such as development tools ADT or debug monitoring systems DDMS can create a ADB client.

Server program: In the background of the development environment, the server program is responsible for managing communication between client programs and daemon programs.
Daemon Program (Daemon): Running in the background of an actual hardware device or virtual device.
The ADB command is located in the Platform-tools path under the installation path and the ADB command can be used in other directories by adding this path to the environment variable path.

Standard format for ADB commands

adb [-d|-e|-s <serialnumber>] <command>
This is the standard format for the ADB command, and when you are executing a number of emulators, add the emulator serial number to differentiate:

Use the "-s <serialNumber>" option parameter;
With the "-d" option parameter, the ADB command is sent only to the actual hard device connected to the USB;
With the "-e" option parameter, the ADB command is sent only to the Android emulator.

The back <command> is the necessary command.

Installing and uninstalling Application APK files

Installation:
ADB [s <serialnumber>] Install <path_to_apk>

Example: Install helloworld.apk to a virtual device with the Android emulator serial number 5556:

Adb–s emulator-5556 Install helloworld.apk
ADB install helloworld.apk

When you install the APK component program with ADB install, the APK component installed on the Android emulator is placed under the/data/app of the Android system directory, where the application file name is the package name that is set when the program is written.

Unloading:

ADB [s <serialnumber>] Uninstall <package>
Example:

Adb–s emulator-5556 Uninstall com.example.android.helloWorld.apk
ADB uninstall com.example.android.helloWorld.apk

Note that the installation is the APK file path name, and the removal is the package name.

Manual removal:

ADB shell
CD Data/app
RM app.apk

Android operating system command line mode, using shell command

Perform

ADB shell

Access to the Android operating system command-line mode, so you can manage and query the Android operating system directory and execute related commands.

Because the Android operating system is one of the Linux operating systems, the shell commands are the same as the Linux operating system, such as the LS command displays the file directory, the CD command changes the file directory, the mkdir command creates the directory, the rmdir command deletes the directory, the RM command deletes the file, The MV command moves the file.

After entering the Android operating system command line mode, you can use the Exit command to leave back to the console window.

Upload files to/sdcard or download files from/sdcard (copy files)

Upload, that is, copy files from the system to the device:
ADB push <local> <remote>
such as: adb push d:test.txt/sdcard/
Download, that is, copying files from the device to the system:
ADB pull <remote> <local>
such as: ADB pull/sdcard/test.txt d:/

Publishing 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

Search/wait simulator, device instance

Gets the currently running emulator, the list of instances of the device, and the status of each instance | Waiting for a running device.
ADB devices
ADB wait-for-device

View Bug reports

ADB bugreport

Record Wireless communication Log

ADB shell
Logcat–b Radio


Get device ID and serial number

ADB get-product

ADB Get-serialno

accessing Database SQLite3

ADB shell
Sqlite3

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.