1.2 Device management Tools-Debug Bridge (ADB) 1.2.1ADB Introduction
The full name of the ADB is Android Debug Bridge, a tool that comes with the Android SDK, which can be used to manage the Android emulator (Emulator) or the real Android device directly.
ADB has a lot of functions, the main features we use are:
1) shell command line to run the device;
2) Manage port mappings for simulators or devices;
3) upload/download files between the computer and the device;
4) Install the local APK software into the simulator or Android device.
ADB is a client-server program where the client is the computer you use to operate, and the server side is the Android device. We want to use the ADB tool, the first to open the USB debugging items on the phone, the specific steps are: Setup---Application development->USB debugging (may be different devices, the specific steps are also slightly difference).
1.2.2ADB Common Command Introduction
1) Viewing the device
ADB devices
This command is to view the currently connected device and display all the Android devices and emulators currently connected to the computer.
Figure 1-5 Viewing the command window for a device
2) Install the software
ADB install <apk file path >
This command installs the specified APK file on the device.
Figure 1-6 Installing the Software Command window
3) 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.
Figure 1-7 Uninstalling the Software command window
In particular, it is important to note that when installing, the following parameters are the apk file path, and the parameter is the package name when uninstalling.
4) Login Device shell
ADB shell
adb Shell <command Command >
This command will log on to the device's shell, followed by the <command command > will be run directly from the device command, equivalent to executing a remote command.
Figure 1-8 Landing Device Shell Command window
5) Copy files from the computer to the device
ADB Push < Local path > < remote path >
Use the push command to copy files or folders on the computer to the device
Figure 1-9 Copying a file or folder command window
6) Download files from the device to the computer
ADB pull < Remote path > < local path >
Use the pull command to copy files or folders on your device to a local computer
Figure 1-10 Download file from device Command window
7) Display Help information
ADB Help
This command displays help information, and if some commands and parameters are not familiar, you can find the answer from the help information.
Figure 1-11 Displaying the Help information Command window
8) Connecting the device
ADB Connect < Equipment ip>
Figure 1-12 Connecting the device command window
9) Disconnect the current connection
ADB kill-server
Figure 1-13 Disconnect Command Window
Experience Sharing: Sometimes, we may not need some software that comes with the ROM and want to uninstall it. However, the Android system does not have the ability to uninstall ROM software, this time we can also use the ADB to uninstall the software. 1) Get root access to the phone; 2) Download android_db. RAR, decompression to%windir/%system32 under; 3) Connect the data cable to the phone, open cmd on the computer, and enter the command: ADB remount ADB shell Su Once the execution is complete, you will see: * Daemon not running. Starting it now * * Daemon started successfully * 4) followed by the Linux command line mode, enter: CD System/app You will find no change, then enter the LS return. This time the list shows all the files in the System/app, which is the ROM integration of some software. 5) Delete command: RM file Name In addition, it is important to note that for those who do not understand the files, please do not arbitrarily delete, to avoid problems with the phone. |
Experience Sharing: In the process of using eclipse to develop Android apps, sometimes errors may be found during debugging and the error message is not connected to the ADB server. You can now kill the Adb.exe process in Task Manager and then restart Eclipse. |
Chapter 工欲善其事 its prerequisite-android SDK tools (2)