Android Note: Android ADB shell command

Source: Internet
Author: User
Tags linux shell commands

 

ADB Overview

The tools folder of the SDK contains important commands for Android simulator operations.
ADB and ADB are all called (Android debug bridge is the function of debugging bridge. Through ADB, We can debug Android programs through ddms in eclipse. With this tool, we can manage the status of devices or mobile phone simulators. You can also perform the following operations:
 
1. quickly update the code in a device or mobile phone simulator, such as an application or Android system upgrade;
2. Run shell commands on the device;
3. Manage the ports on the device or mobile phone simulator;
4. Copy or paste files on the device or mobile phone simulator;

ADB's work in the integrated development environment
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.
For example, ADB shell DIR is used to list directories.
The root directory is drive C and drive D instead of drive D on Windows.
2. Install the APK program to the simulator and run ADB install android123.apk. The installation package named android123will be installed in the androidsimulator. The preceding file is the android123.apk file which needs to be placed in the SDK/tools directory.
3. Send the file to emulator and use the ADB to push android123.txt/tmp/android123.txt command.
You can transfer the android123.txt file under SDK/toolsto the/tmp/folder of the simulator. Note that the content in the/tmp/folder will be cleared when the android simulator restarts.
4. Returning files from the android simulator to the computer
Run the ADB pull/tmp/android123.txt android123.txt command.
The directory android123.txt under the tmpfile of the simulator will be uploaded back to the computer SDK/tools directory.
 
ADB Common commands
1. Install the application to the simulator:
ADB install <path_to_apk> </path_to_apk>
Uninstall command

ADB uninstall com. ***** uninstall the command
The parameter must be the total package name
2. Enter the shell of the device or simulator:
ADB Shell
Through the above command, you can enter the shell environment of the device or simulator, In this Linux
Shell, You can execute various Linux commands
In addition, if you only want to execute a shell command, you can use the following method:
ADB shell [command]
For example, ADB shell dmesg prints the kernel debugging information.
3. Release Port:
You can set any port number as the request port from the host to the simulator or device. For example:
ADB forward TCP: 5555 TCP: 8000
4. copy a file:
You can copy files to or from a device,
Copy a file or directory to the device or simulator:
ADB push <source> <destination> </source>
Example: ADB push test.txt/tmp/test.txt
Copy a file or directory from a device or simulator:
ADB pull <source> <destination> </source>
For example, ADB pull/addroid/lib/libwebcore. So.
5. Search for simulator/device instances:
Obtain the list of running Simulators/devices and the status of each instance:
ADB Devices
6. view the bug report:
ADB bugreport
7. Record wireless communication logs:
Generally, there are a lot of wireless communication logs and there is no need to record them at runtime, but we can still use the command
, Set record:
ADB Shell
Logcat-B radio
8. Get the device ID and serial number:
ADB get-Product
ADB get-serialno
9. Access the 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.