Difference between revisions of "Android: ADB setup"
(→ADB over USB) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | Android Debug Bridge is | + | = Overview = |
− | To name a few of its features | + | Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with connected Android-powered device or an emulator instance.<br/> |
+ | To name a few of its features: | ||
* command line shell | * command line shell | ||
* installed package management | * installed package management | ||
* IDE interface for application development | * IDE interface for application development | ||
− | + | * Android device available access options are: | |
− | + | ** Over network (IP) | |
− | + | ** Over USB link | |
− | |||
− | == ADB over IP | + | Please refer to [http://developer.android.com/tools/help/adb.html Android developer network] for more details. |
− | ADB over IP | + | |
− | + | = Getting ADB = | |
− | + | In general ADB is provided within the [http://developer.android.com/sdk/index.html Android SDK]. Also some Linux disributions provide the ADB within their package repositories. | |
− | + | For example, on Ubuntu platform, ADB may be obtained via {{parameter|android-tools-adb}} package. | |
− | + | ||
− | + | = ADB over IP = | |
− | + | ADB over IP may be configured by executing the following command line on the Android device: | |
− | + | <pre>user@android $ setprop service.adb.tcp.port 5555</pre> | |
− | + | ||
− | Among useful '' | + | To access Android device, type in on the host PC: |
− | * devices - list connected devices | + | <pre> |
− | * shell - run command line shell | + | root@ubuntu $ export ADBHOST=<Android-device-IP-address> |
− | * logcat - view Android log | + | root@ubuntu $ adb kill-server |
+ | root@ubuntu $ adb start-server | ||
+ | root@ubuntu $ adb <arguments> | ||
+ | </pre> | ||
+ | |||
+ | Among useful ''arguments'' are<br/> | ||
+ | * devices - list connected Android devices | ||
+ | * shell - run command line shell | ||
+ | * logcat - view Android log | ||
* install - install Android application (*.apk) | * install - install Android application (*.apk) | ||
* push - copy file from host to Android device | * push - copy file from host to Android device | ||
− | + | = ADB over USB = | |
− | * Properly configure a Linux PC workstation, | + | * Properly configure a Linux PC workstation, e.g. on Ubuntu this should be: |
− | + | <pre>root@ubuntu $ echo SUBSYSTEM==\"usb\", ATTR{idVendor}==\"18d1\", MODE=\"0666\", GROUP=\"plugdev\" >> /etc/udev/rules.d/51-android.rules</pre> | |
− | * ADB over USB requires ADB over IP be disabled.<br/>Test ADB TCP port by executing | + | |
− | + | * ADB over USB requires ADB over IP be disabled.<br/> | |
+ | :Test ADB TCP port by executing on Android device: | ||
+ | <pre>user@android $ getprop service.adb.tcp.port</pre> | ||
+ | |||
:If there is a value, and it is not -1 - it should be set to -1: | :If there is a value, and it is not -1 - it should be set to -1: | ||
− | + | <pre>user@android $ setprop service.adb.tcp.port -1</pre> | |
− | * In Android graphic user interface enable ''Settings->Developer options->USB debugging''. | + | |
− | * Connect | + | * In Android graphic user interface enable '''Settings'''->'''Developer options'''->'''USB debugging'''. |
+ | {{Note|If '''Developer options''' item is hidden (as is the default in Jelly Bean and newer), re-introduce it proceeding to '''Settings'''->'''About tablet''' and clicking on '''Build number''' 7 times consequently.}} | ||
+ | * Connect the PC workstation to the Android device OTG port with a USB cable. | ||
+ | :At this point running {{cmd|adb devices}} on the PC workstation should list your Android device among attached ones. | ||
+ | * In newer Android releases, a dialog might pop up on the Android device, requesting the user to confirm connection to a particular PC. | ||
+ | |||
+ | To access the Android device, type in on the PC workstation: | ||
+ | <pre> | ||
+ | user@android $ adb kill-server | ||
+ | user@android $ adb start-server | ||
+ | user@android $ adb <arguments> | ||
+ | </pre> | ||
− | = | + | = See Also = |
− | + | * [http://developer.android.com/tools/help/adb.html Android developer network] | |
− | + | * [http://developer.android.com/sdk/index.html Android SDK] | |
− | |||
[[Category:Android|ADB setup]] | [[Category:Android|ADB setup]] |
Latest revision as of 06:12, 6 April 2014
Overview
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with connected Android-powered device or an emulator instance.
To name a few of its features:
- command line shell
- installed package management
- IDE interface for application development
- Android device available access options are:
- Over network (IP)
- Over USB link
Please refer to Android developer network for more details.
Getting ADB
In general ADB is provided within the Android SDK. Also some Linux disributions provide the ADB within their package repositories. For example, on Ubuntu platform, ADB may be obtained via android-tools-adb package.
ADB over IP
ADB over IP may be configured by executing the following command line on the Android device:
user@android $ setprop service.adb.tcp.port 5555
To access Android device, type in on the host PC:
root@ubuntu $ export ADBHOST=<Android-device-IP-address> root@ubuntu $ adb kill-server root@ubuntu $ adb start-server root@ubuntu $ adb <arguments>
Among useful arguments are
- devices - list connected Android devices
- shell - run command line shell
- logcat - view Android log
- install - install Android application (*.apk)
- push - copy file from host to Android device
ADB over USB
- Properly configure a Linux PC workstation, e.g. on Ubuntu this should be:
root@ubuntu $ echo SUBSYSTEM==\"usb\", ATTR{idVendor}==\"18d1\", MODE=\"0666\", GROUP=\"plugdev\" >> /etc/udev/rules.d/51-android.rules
- ADB over USB requires ADB over IP be disabled.
- Test ADB TCP port by executing on Android device:
user@android $ getprop service.adb.tcp.port
- If there is a value, and it is not -1 - it should be set to -1:
user@android $ setprop service.adb.tcp.port -1
- In Android graphic user interface enable Settings->Developer options->USB debugging.
If Developer options item is hidden (as is the default in Jelly Bean and newer), re-introduce it proceeding to Settings->About tablet and clicking on Build number 7 times consequently. |
- Connect the PC workstation to the Android device OTG port with a USB cable.
- At this point running adb devices on the PC workstation should list your Android device among attached ones.
- In newer Android releases, a dialog might pop up on the Android device, requesting the user to confirm connection to a particular PC.
To access the Android device, type in on the PC workstation:
user@android $ adb kill-server user@android $ adb start-server user@android $ adb <arguments>