Original article, if reproduced, please indicate the source: http://blog.csdn.net/yihui823/article/details/6686642
Prerequisites: eclipse and ADT have been installed. The android SDK has been downloaded. In eclipse, you have already set the android SDK for this article.
This article introduces the android debugging tools. I hope it will be helpful to you.
ADB
ADB = Android debug Bridge
As the name suggests, this is the connection bridge between a PC and an Android device. In short, the PC can control the connected Android devices through ADB.
1. After the Android mobile phone is connected to a PC or the virtual machine is started, the PC usually detects the device and automatically connects to it. Run the following command to view the list of connected devices:
> ADB Devices
2. Android is a Linux system. We can use ADB to start a Linux terminal and execute Linux commands on Android. Perform the following operations:
> ADB Shell
After the command is executed, go to the android terminal and run all the input commands on the mobile phone. For example, if we enter ls, the files and directories we see are in the mobile phone.
3. Restart your phone. Sometimes the phone is locked, or the screen is occupied by an infinite pop-up window, and cannot be restarted. You can use ADB to restart the phone.
> ADB reboot
4. Sometimes, problems may occur when the mobile phone is connected to the PC. You can use ADB devices to view a question mark. At this time, you can try:
> ADB kill-Server
Enter the following command immediately (experience, within 10 seconds:
> ADB Devices
In this way, the phone will re-connect to the PC.
5. copy the file to your mobile phone.
> ADB push [PC file path] [mobile phone directory]
Because only one file can be copied to the mobile phone at a time. If you need to copy multiple files, you can write a shell by yourself.
6. Copy files from your mobile phone to your PC.
> ADB pull [mobile phone file path] [PC Directory]
Likewise, only one file can be copied at a time.
7. Install APK on your mobile phone.
> ADB install [APK path on PC]
You can set whether to allow non-signature applications to be installed on your Android phone. However, this setting can be bypassed by using the ADB install method. That is to say, whether or not non-signature applications can be installed on the mobile phone, the APK can always be installed on the mobile phone with ADB install.
Correspondingly, there are
> ADB uninstall [application package name]
8. Sometimes, the connection becomes unstable. At this time, you need to re-mount the phone. Run the following command:
> ADB remount
9. view the log
> ADB logcat
By the way, we will introduce two important directories on the mobile phone:
/System/APP/: basically, all APK files are stored in this directory.
/Data/: private data of each application is stored in this directory. There are many directories in this directory according to the package name of each application. Under each package name, private data of the corresponding application is stored, including the database and private configuration.