Chapter 1 to do a good job, you must first use the Android SDK (2) and androidsdk
1.2 device management tools-Introduction to debugging bridge (ADB) 1.2.1ADB
ADB, short for Android Debug Bridge, is a tool that comes with the Android SDK. It can be used to directly manage Android simulators (Emulator) or real Android devices.
ADB has many functions, and we mainly use the following functions:
1) run the shell command line of the device;
2) Manage the port ing of simulators or devices;
3) upload/download files between computers and devices;
4) install the local apk software on the simulator or Android device.
ADB is a client-server program, where the client is the computer you use to operate and the server is an Android device. We need to use the ADB tool. First, we need to open the USB debugging item on the computer. The specific operation steps are: set-> application-> development-> USB debugging (the device may be different, the specific operation steps are also slightly different ).
1.2.2ADB Common commands
1) view Devices
Adb devices
This command is used to view the currently connected devices and display all Android devices and Simulators currently connected to the computer.
Figure 1-5 Command window for devices
2) install software
Adb install <apk file path>
This command installs the specified apk file on the device.
Figure 1-6 software installation command window
3) uninstall software
Adb uninstall <package name>
Adb uninstall-k <package name>
If the-k parameter is added, the software is uninstalled but the configuration and cache files are retained.
Figure 1-7 uninstall software command window
Note that during installation, the following parameters are the apk file path, while the parameters are the package name when the package is uninstalled.
4) log on to the device shell
Adb shell
Adb shell <command>
This command will log on to the shell of the device, followed by the <command> command to directly run the device command, equivalent to executing the remote command.
Figure 1-8 login 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 local computer to the device.
Figure 1-9 command window for copying files or folders
6) download files from the device to the computer
Adb pull <remote path> <local path>
Run the pull command to copy files or folders on the device to the local computer.
Figure 1-10 command window for downloading files from a device
7) display help information
Adb help
This command displays help information. If you are not familiar with some commands and parameters, you can find the answer from the help information.
Figure 1-11 show the help information command window
8) connect the device
Adb connect <device IP address>
Figure 1-12 device connection command window
9) disconnect the current connection
Adb kill-server
Figure 1-13 disconnect command window
Experience Sharing: Sometimes, we may not need some built-in ROM software and want to uninstall it. However, the Android system does not uninstall the built-in ROM software. In this case, we can also use ADB to uninstall these software. 1) obtain the root permission of the mobile phone; 2) download Android_db. Rar, decompress it to % windir/% System32; 3) connect your mobile phone to the data cable, open cmd on your computer, and enter the following command: Adb remount Adb shell Su After the execution is complete, you will see: * Daemon not running. Starting it now * * Daemon started successfully * 4) the Linux Command Line Mode is followed. Enter: Cd system/app You will find that there is no change, and then enter ls to press Enter. At this time, the list shows all the files in the system/app, that is, some Rom integrated software. 5) Delete the command: Rm file name In addition, do not delete files that you do not know at will to avoid problems with your mobile phone. |
Experience Sharing: When using Eclipse to develop Android applications, sometimes errors may be reported during debugging. The error message is that the adb Server cannot be connected. The producer can kill the adb.exe process in the task manager and restart Eclipse. |