ADB [Android Debug Bridge](https://developer.android.com/studio/command-line/adb.html), it is not only irreplaceable powerful tool for Android developers/testers, but also a good toy to play with Android devices.
ADB ([Android Debug Bridge](https://developer.android.com/studio/command-line/adb.html)), it is not only irreplaceable powerful tool for Android developers/testers, but also a good toy to play with Android devices.
This repo is continuously updated, if you found mistake/issue please create issue or create pull request.
This repo is continuously updated, if you found mistake/issue please create issue or create pull request.
If you found that info useful [this GitHub repository](https://github.com/mzlogin/awesome-adb) please star this repo.
Thanks.
**Note:** There may be supported by part of the command and the version of Android and custom ROM implementation-dependent.
If you found [this GitHub repository](https://github.com/mzlogin/awesome-adb) is useful, please star this repo. Thanks.
#![Table of Contents](./assets/toc.png)
**Note:** Some commands may not supported well depends on the version of Android and ROM.
Other languages:
* [Chinese](./README.md)
#![Table of Contents](./assets/toc.png)
<!-- vim-markdown-toc GFM -->
<!-- vim-markdown-toc GFM -->
* [Basic Usage](#Basic Usage)
* [Basic Usage](#basic-usage)
* [Command Syntax](#command syntax)
* [Command syntax](#command-syntax)
* [Targeting equipment for command](#targeting equipment for command)
* [Targeting equipment for command](#targeting-equipment-for-command)
* [Start / stop](#start stop)
* [Start/Stop](#startstop)
* [See adb version](#View -adb- version)
* [View adb version](#view-adb-version)
* [Running as root adbd](#-root- permission to run -adbd)
* [Run adbd as root](#run-adbd-as-root)
* [Specify adb server network port](#designated -adb-server- network port)
* [Designated adb server network port](#designated-adb-server-network-port)
| -d | Specifies currently the only Android device USB connector as the command target |
| -d | Specifies currently the only Android device USB connector as the command target |
| -e | Specify currently the only goal for the command to run the simulator |
| -e | Specify currently the only goal for the command to run the simulator |
| `-s <SerialNumber>` | Specifies the device number corresponding serialNumber / simulator command target |
| `-s <SerialNumber>` | Specifies the device number corresponding serialNumber / simulator command target |
@ -170,7 +140,7 @@ Android Debug Bridge version 1.0.36
Revision 8f855a3d9b35-android
Revision 8f855a3d9b35-android
```
```
### To run as root adbd
### Run adbd as root
The operating principle is adb adb server daemon and the phone side PC side adbd establish a connection, then the PC side adb client via adb server forward command parsing after running adbd receive commands.
The operating principle is adb adb server daemon and the phone side PC side adbd establish a connection, then the PC side adb client via adb server forward command parsing after running adbd receive commands.
@ -301,7 +271,7 @@ Steps:
5. Find the IP address of the device.
5. Find the IP address of the device.
Generally the 'Settings' in - "About phone" - "state information" - "IP address" is found, you can also use the following in the [View device information - IP address][1] a Lane method adb command.
Generally the 'Settings' in - "About phone" - "state information" - "IP address" is found, you can also use the following in the [View device information - IP address][1] a Lane method adb command.
6. Connect the device via IP address.
6. Connect the device via IP address.
@ -360,7 +330,7 @@ Since we want to achieve a wireless connection, it can all step down are wireles
4. Find the IP address of the Android device.
4. Find the IP address of the Android device.
Generally the 'Settings' in - "About phone" - "state information" - "IP address" is found, you can also use the following in the [View device information - IP address][1] a Lane method adb command.
Generally the 'Settings' in - "About phone" - "state information" - "IP address" is found, you can also use the following in the [View device information - IP address][1] a Lane method adb command.
5. Connect Android device on a computer via adb and IP addresses.
5. Connect Android device on a computer via adb and IP addresses.
That is the basis of `adb shell pm list packages` can add some parameters on the filter to view different lists, supports filtering parameters are as follows:
That is the basis of `adb shell pm list packages` can add some parameters on the filter to view different lists, supports filtering parameters are as follows:
`Adb install` may be followed by some optional parameters to control the behavior of the installation APK, available parameters and their meanings are as follows:
`Adb install` may be followed by some optional parameters to control the behavior of the installation APK, available parameters and their meanings are as follows:
| `-a <ACTION>` | specified action, such as `android.intent.action.VIEW` |
| `-a <ACTION>` | specified action, such as `android.intent.action.VIEW` |
| `-c <CATEGORY>` | specify a category, such as `android.intent.category.APP_CONTACTS` |
| `-c <CATEGORY>` | specify a category, such as `android.intent.category.APP_CONTACTS` |
| `-n <COMPONENT>` | specify the full component name, which is used to explicitly specify the start Activity, such as `com.example.app / .ExampleActivity` |
| `-n <COMPONENT>` | specify the full component name, which is used to explicitly specify the start Activity, such as `com.example.app / .ExampleActivity` |
@ -645,9 +615,9 @@ Options for determining intent objects as follows:
`<INTENT>` can bring in data, like Bundle write code like:
`<INTENT>` can bring in data, like Bundle write code like:
| `--esn <EXTRA_KEY>` | null value (only key name) |
| `--esn <EXTRA_KEY>` | null value (only key name) |
| `-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE>` | string value |
| `-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE>`| string value |
| `--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>` | boolean value |
| `--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>` | boolean value |
| `--ei <EXTRA_KEY> <EXTRA_INT_VALUE>` | integer value |
| `--ei <EXTRA_KEY> <EXTRA_INT_VALUE>` | integer value |
| `--el <EXTRA_KEY> <EXTRA_LONG_VALUE>` | long value |
| `--el <EXTRA_KEY> <EXTRA_LONG_VALUE>` | long value |
@ -722,7 +692,7 @@ Such usage is very practical in the test, such as a broadcast scenes difficult t
Both predefined broadcast transmission system can also send a custom broadcast. The following is part of the normal pre-defined radio and Trigger timing:
Both predefined broadcast transmission system can also send a custom broadcast. The following is part of the normal pre-defined radio and Trigger timing:
| android.net.conn.CONNECTIVITY_CHANGE | Fi changes |
| android.net.conn.CONNECTIVITY_CHANGE | Fi changes |
| android.intent.action.SCREEN_ON | screen lit |
| android.intent.action.SCREEN_ON | screen lit |
| android.intent.action.SCREEN_OFF | screen off |
| android.intent.action.SCREEN_OFF | screen off |
@ -834,7 +804,7 @@ The commands and default sources are:
Such as using `adb shell input keyevent <keycode>` command, different keycode to achieve different functions, keycode complete list see [KeyEvent] (https://developer.android.com/reference/android/view/KeyEvent. html), I think the interesting part of the quote is as follows:
Such as using `adb shell input keyevent <keycode>` command, different keycode to achieve different functions, keycode complete list see [KeyEvent] (https://developer.android.com/reference/android/view/KeyEvent. html), I think the interesting part of the quote is as follows:
@ -1547,7 +1517,7 @@ This will output a lot of information, including the previously mentioned severa
In output also includes some other useful information, they can also be `adb shell getprop <attribute name>` command alone, part of the property include the following:
In output also includes some other useful information, they can also be `adb shell getprop <attribute name>` command alone, part of the property include the following: