How to get started with the android SDK adb command
[Basic Introduction]
The adb command is often used to learn about android. ADB stands for Android Debug Bridge and is a tool in the android sdk,
ADB is a "client-server" program, where the client is the computer that operates, and the server is an android device, including the Virtual Machine of the real machine quit. You can use this command to directly manage android simulators or real android devices.
Its main functions include:
* Run the shell (command line) of the device)
* Manage the port ing of the simulator quit Device
* Upload/download files between computers and devices
* Install the local apk software on the android device of the simulator.
Abd command Configuration:
Add the following path to the path
%android_home%/platform-tools
You can use it in CMD or Console.
[Common commands]
1. View device information
adb devices
2. Install software
adb install
3. uninstall software
Adb uninstall
<软件名>
Adb uninstall-k
<软件名>
4. Enter the shell of the device or simulator.
adb shell
One function is to view the specific parameters of the mobile phone.
You can view the specific commands of the mobile phone system as follows:
Getprop: view all information about the machine. getprop ro. serialno: view the machine's SN getprop ro. carrier: Check the CID of the machine. getprop ro. view the machine Board Sub-code getprop ro in hardware. view the SPL (Hboot) version number of bootloader
5. Release Port
You can set any port number as the request port from the host to the simulator device. For example:
adb forward tcp:5555 tcp:8000
6. Send files to the device from the computer
Adb push
<本地路径>
<远程路径>
7. download files from the device to the computer
Adb pull
<远程路径>
<本地路径>
8. Start and close the ADB Service
sudo adb start-server
After the daemon process is successfully started and started, you can use the daemon with adb XXX.
sudo adb kill-server
End the daemon process.
[Common Errors]
When entering adb, the following errors are often reported:
error: more than one device and emulator
There are two common causes of this problem:
1. Multiple devices or simulators are connected.
Solution: Specify to connect to a device or Simulator
1. Obtain the simulator/device list
adb devices
2. Specify the device to execute the adb shell.
adb -s devicename shell
For example:
adb -s emulator-5554 shell
When executing the adb command for multiple devices, you usually need to specify the device with the-s parameter. For example, uninstall the package com. soft. camera on emulator-5554.
adb -s emulator-5554 uninstall com.soft.camera
In the second case, there is indeed a device or simulator (the reason why multiple devices are displayed is that the device has been used twice. Using the command adb devices, you can see that the device has two types: offline and device)
Solution:
General method: Enter adb start-server in the Command window to restart the adb.exe Service
If the above method is not feasible, the ultimate method is to open the task bar, select the route Route Navigation component, find the adb.exe process, end it, and restart it to complete OK (or enter the command adb kill-server in the Command window)
adb start-server adb kill-server
References:
Http://blog.csdn.net/hellofeiya/article/details/8108317
Http://android.tgbus.com/lab/break/201106/357610.shtml
Http://blog.sina.com.cn/s/blog_7ffb8dd50100wvrb.html