ADB is a tool in the Android SDK that allows you to directly manipulate the Android emulator or the real andriod 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.
Its main functions are:
- Shell running the device (command line)
- Manage port mappings for emulators or devices
- Upload/download files between your computer and your device
- Install the local APK software to the emulator or Android device
ADB is actually the abbreviation of Android Debug Bridge, Android Debugging Bridges, ADB is a C/s Architecture command-line tool, consisting mainly of 3 parts:
Client running on PC: it can install, uninstall, and debug Android apps.
Tools such as ADT in Eclipse, DDMS in the SDK Tools directory, and Monitor are all equally used by ADB to interact with Android devices.
Port number used by the ADB service: 5037
PC-side phone helper, such as 360 mobile phone assistant, Pea pod, app Bao, etc., in addition to the installation of third-party applications convenient, and other functions, basically can be done through the ADB command, it is important to note that the own ADB program may conflict with the ADB program under the Android SDK, 5037 Port is occupied, resulting in the inability to connect to the device when using the ADB command.
Service running on the PC side: its management client connects to the ADB background process on the Android device
After the ADB service starts, Windows can find the Adb.exe process in Task Manager
ADB process
ADB background process running on Android devices, executing adb shell PS | grep adbd, can find the background process, under Windows execute ADB shell PS |findstr adbd
ADB command
In the process of development or testing, we can manage multiple devices through the ADB in the general format of:
adb [-e |-D |-s < device serial number;] < sub-command >
With the environment variables in place, enter ADB help in the command window or enter ADB directly, and all the option descriptions and subcommands will be listed.
ADB devices, get device list and device status
ADB get-state, getting the status of the device
The state of the device is 3 minutes, device, offline, unknown
Device: normal connection of devices
Offline: Connection unexpected, device not responding
Unknown: No device connected
ADB logcat, print system logs for Android
ADB bugreport, prints the output of Dumpsys, Dumpstate, Logcat, and is also used for parsing errors
More output, recommended redirection to a file
ADB bugreport > D:\bugreport.log
ADB install, installation application, overwrite installation is using the-r option
If you need to install APK with Chinese name under Windows, you can modify the APK package name directly
1. cmd-Enter the directory where the application is located (C:\WDJDownload\Apps)
2. Execute command: adb install aiqiyi.apk (apk name)
3. The phone will be prompted whether to agree to install, click Agree, to install
4. The installation of the mobile phone is successful, success indicates the installation is successful.
ADB uninstall, uninstalling apps,
The following parameter is the app's package name, please distinguish it from the APK file name
ADB pull to copy files or folders on your Android device to a local
For example, copy the init file to the D drive: adb pull init d:\
If you need to rename the rename.txt:adb pull init d:\rename.txt
Note the permissions, copy the files in the directory under System permissions, need root
ADB push, push local files to Android device
For example, push the testrabbit.txt to/MNT:ADB push d:\testrabbit.txt/mnt/under the D drive
D:\>ADB Push testrabbit.txt/mnt/
Failed to copy ' Testrabbit.txt ' to '/mnt//testrabbit.txt ': Read-only file system
In the shell command line, type: adb root
Switch to root user
Then execute the following command: (note/represents the root directory, so this is not just for sdcard, other files can also read and write.) RW indicates read and write permissions, mount mounts file system)
ADB shell mount-o remount RW/Modify system read and Write permissions
[Email protected]:/# adb shell mount-o remount RW/
ADB root, adb remount, can directly have these two commands to get root permissions, and mount the system file system as read-write status
Learning Communication qq:270224761 (EP)
Android Common ADB command Summary (i)