Android ADB command Introduction

Source: Internet
Author: User
Tags linux shell commands

The tools folder of the SDK contains the android operation's Important Command ADB. The ADB is called (Android debug bridge is the function of debugging bridge. Through ADB, We can debug the android program through ddms in eclipse. To put it bluntly, the debug tool is a major feature of Android, which is very convenient for developers.

 

Then, we need to know that ADB can be used not only in debug and debugging, but also in code to implement our logic. Run the ADB command in Java as follows:

 

Runtime. getruntime () <br/>. Exec ("ADB push D:/ex04_33.apk/data/local/tmp "); 

 

ADB works in a special way by listening to socket TCP 5554 and other ports to allow the IDE to communicate with qemu. By default, ADB will use the network port related to daemon, so when we run eclipse, the ADB process will automatically run.

 

1. Using ADB, you can easily execute Linux shell commands, suchADB shell dirIs to list the directory. in Linux, the root directory is/, not the drive C and drive D on Windows. For example, the ADB shell DIR/sdcard prompts that permission denied is not satisfactory. If the fee is enough, it cannot be used in the code.

 

2. Install the APK program and run it on the simulator.ADB installXxx.apk. The installation package named xxxwill be installed in the androidsimulator and the real machine. The preceding file xxx.apk needs to be put into your execution.ADB installIn the CMD directory when the xxx.apk command is run,

You must have a file named xxx.apk in the mongod root directory.

In addition, it should be noted that XXX is a common file name and can be modified at will. Do not mix it with the package name of APK during uninstallation.

There is another way to install APK: (first push the APK to a directory on the mobile phone, and then execute install)

ADB push D:/xxx.apk/data/local/tmp </P> <p> ADB shell PM install/data/local/tmp/xxx.apk <br/>

In addition, ADB install also has a very useful parameter "-R", which means to update and install, that is, to replace the previous package, the content settings of the original installed software remain unchanged. This is useful when we develop programs to upgrade the software on our mobile phones. The user experience is good, because you do not need to uninstall the previous package before installing it.

 

3. Send a file to Android and useADB push D :/The xxx.txt/sdcard/xxx.txtcommand transfers the xxx.txt file under the D Drive to the/sdcard folder of the simulator. Note that the file is only available on the real machine in the/tmp/folder, but not in the simulator when writing code.

4. display the android simulator status

ADB devices port number and other information. After execution, the TCP port number is displayed.
ADB get-product get Device Model
ADB get-serialno get the serial number

5. Waiting for a running Device

ADB wait-for-Device

6. port forwarding

ADB forward TCP: 5555 TCP: 1234 is used to forward the default TCP 5555 port to port 1234.

7. view the bug report

ADB bugreport

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.