Objective
Use your spare time to organize your Android test-related knowledge and consolidate what you've learned;
Can let the students want to learn Android test more than one study material.
What is ADB
What is ADB? Why the phone and the computer with a USB connection, you can be on the computer through the application of Bao or pea pods and other mobile phone help
Hand software to operate the phone?
The answer is: because it all depends on the ADB. The adb is the bridge between mobile phone and computer communication, as long as the bridge is built up,
Then you can control your phone through a computer.
ADB full name Android Debug Bridge, I interpret it as "the Bridge for Android debugging", he is composed of three parts:
1 Client: run on your computer, you can invoke a client through the shell. Other Android
Tools, such as ADT plug-ins, DDMS can create a client
2 server: running in the background of your computer, responsible for managing client and daemon communication.
3. Daemon daemon: Run in the background of the emulator or Android device.
But it finally presents us with a command line tool that we can use to
Communicate with the simulator or Android device. It is in the <sdk>/platform-tools/directory:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/8A/30/wKiom1gqdRmRjo2NAAGz7xjZBUQ582.png "title=" 1.png " alt= "Wkiom1gqdrmrjo2naagz7xjzbuq582.png"/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/8A/2D/wKioL1gqdRqByuUPAAD5a5XOFss221.png "title=" 2.png " alt= "Wkiol1gqdrqbyuupaad5a5xofss221.png"/>
Each time you start the client, the first check whether the server is already running in the background, if not, he will start the server process;
If the server is turned on, the server binds to the TCP 5037 Port and listens to the command sent by the client;
All clients communicate through the 5037 port and the server.
USB Debugging
When we use the ADB via USB cable, it is often necessary to tick the box "settings"-"Developer Options"-"USB Debug".
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8A/30/wKiom1gqddmDMFLHAAC28jab9gU265.png "title=" 3.png " alt= "Wkiom1gqddmdmflhaac28jab9gu265.png"/>
It is important to note that in some Android 4.2.2 versions, the developer options are hidden, so you need to set the
"-" About mobile "-" Android version "click here 7 consecutive times, then" developer Options "appears.
ADB command
Connect the phone, configure the environment variables (direct search "ADB environment variable Configuration" will be a lot of) you can use the command. Here's a list of commonly used commands
adb devices view current connected devices
Displays an ordinal and status of the current connection:
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101154565646068.png "style=" margin:0 px;padding:0px;border:0px; "/>
adb install <path_to_apk> installation apk file
The path to the APK is the path of the current PC-side file:
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101200455333522.png "style=" margin:0 px;padding:0px;border:0px; "/>
adb-s <serialNumber> <command> Specify device execution commands
SerialNumber is the first column of information in the ADB devices
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101227050028818.png "style=" margin:0 px;padding:0px;border:0px; "/>
adb pull <remote> <local> drag files from Android device to local
General Android Phone The default storage path is "/mnt/sdcard/", we pull a file inside this to C drive
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101338476435005.png "style=" margin:0 px;padding:0px;border:0px; "/>
Then we go down to the computer's C-drive and take a look:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8A/2D/wKioL1gqdw7ypTbcAAGeTp-h2B0448.png "title=" 4.png " alt= "Wkiol1gqdw7yptbcaagetp-h2b0448.png"/>
Files copied through the ADB pull command
adb push <local> <remote> Copy Local files to Android device
and ADB pull is just a pair of opposite orders.
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101344144553761.png "style=" margin:0 px;padding:0px;border:0px; "/>
adb start-server start the ADB server
ADB kill-server shutting down ADB's server
There's a time when the ADB is not responding, we need to restart ADB, but this is typically less.
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101348443937761.png "style=" margin:0 px;padding:0px;border:0px; "/>
adb Shell [Shellcommand] Run shell command
As is known to all, Android is based on the Linux kernel, so you can run shell commands on Android systems
Through the ADB shell can enter the phone system, and then execute some linux commands
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101353558778900.png "style=" margin:0 px;padding:0px;border:0px; "/>
Of course, you can not enter the system, directly use the command
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/626346/201507/101356227996848.png "style=" margin:0 px;padding:0px;border:0px; "/>
For example, the ADB shell installation and uninstallation commands are:
PM Uninstall COM.TENCENT.QQ
PM Install-r "/data/local/tmp/com.tencent.qq"
This article for the personal use of cognition, knowledge points may be some deviation, I hope you can criticize correct.
This article from the "Half wake half drunk half-floating" blog, please be sure to keep this source http://sweettesting.blog.51cto.com/12233355/1872918
"Android Test" "section I" first knowledge of ADB