Introduction and use of ADB commands

Source: Internet
Author: User

The concept of DB

ADB's all-known Android Debug Bridge, is the role of debugging bridges. Through the ADB, we can easily in the ecplise through the DDMS to debug the Android program, in fact, he is a debug tool. However, its work is very special, the use of listening socket TCP 5554 and other ports to the IDE and QEMU communication, by default ADB will daemon the relevant network port, so when we run ecplise, the ADB process will automatically run

The role of ADB

With ADB tools, we can manage the status of devices or phone simulators. You can also do a lot of phone operations, such as installing software, system upgrades, running shell commands, and so on.

Features of the ADB

1). Shell running the device (command line)
2). Manage port mappings for emulators or devices
3). Upload/download files between the computer and the device
4). Install the APK software to the emulator or Android device
5). ADB is a client-server program where the client is the computer you use to operate, and the server side is the Android device.

ADB Operations Command

1. View Online devices
  ADB devices
This command is to view the currently connected device, the Android device connected to the computer, or the emulator will list the display

Where the marked red indicates the state of the device, which has three states:
Devices: This status indicates that the device or emulator is connected to the ADB server.
Offline: This status indicates that the device or emulator is not connected to the ADB service or is not responding.
No devices: This status indicates that there is no physical device or simulator connection.

2. Connecting the device

  ADB Connect * * * *

The command is to connect a device, such as using an Android emulator, to enter

ADB Connect 127.0.0.1:62001

3. Installing the Software

 ADB install
ADB install <apk file path >: This command installs the specified APK file on the device.
Adb–s < device serial number > Install:-S is the serial number with the device.
Adb–s < device serial number > Install-r: Forced installation.

4. Uninstalling the Software

  ADB Uninstall < package name >
ADB uninstall-k < package name >
If you add the-K parameter, the software is uninstalled but the configuration and cache files are preserved.

5. Enter the shell of the device or simulator:  

From the above command, you can enter the device or emulator shell environment, in this Linux shell, you can execute a variety of Linux commands, in addition, if you want to execute only one shell command, you can use the following way:
  ADB Shell [command]
For example, the ADB shell DMESG will print out debug information for the kernel.

6. Publishing ports
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

7. Send files from the computer to the device

ADB Push < Local path > < remote path >

Such as:
ADB push d:/apk/com.tencent.news.apk/sdcard/com.tencent.news.apk
Use the push command to copy files or folders on your computer to your device (mobile)
Download files from your device to your computer
ADB pull < Remote path > < local path >
Such as:

ADB pull/sdcard/com.tencent.news.apk d:/apk/push/com.tencent.news.apk
Use the pull command to copy files or folders on your device (phone) to your local computer

8. output logs using the Logcat command

  ADB logcat Export and display the phone log
ADB logcat–c Erase Phone cache log

ADB command Introduction and use

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.