Difference between revisions of "Android: ADB setup"

From Compulab Mediawiki
Jump to: navigation, search
(ADB over USB)
 
Line 1: Line 1:
Android Debug Bridge is an interface and a command line utility that provides low level control of an Android powered device (physical or emulated).<br/>
+
= 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
Refer to [http://developer.android.com/tools/help/adb.html Android developer network] for more details.<br/>
+
* Android device available access options are:
== Getting ADB ==
+
** Over network (IP)
ADB is provided in the Android SDK.<br/>
+
** Over USB link
To get a prebuilt version of ADB (for Linux/OSX/Windows) proceed to the [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Downloads] section.
 
  
== ADB over IP ==
+
Please refer to [http://developer.android.com/tools/help/adb.html Android developer network] for more details.
ADB over IP is set up by default on CM-FX6.<br/>
+
 
It can be set by executing the following Android command line:
+
= Getting ADB =
    $ setprop service.adb.tcp.port 5555
+
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.
===Access Android device via ADB===
+
For example, on Ubuntu platform, ADB may be obtained via {{parameter|android-tools-adb}} package.
Type in on host PC:
+
 
    $ export ADBHOST=<Android-device-IP-address>
+
= ADB over IP =
    $ adb kill-server
+
ADB over IP may be configured by executing the following command line on the Android device:
    $ adb start-server
+
<pre>user@android $ setprop service.adb.tcp.port 5555</pre>
    $ adb <args...>
+
 
Among useful ''args'' are<br/>
+
To access Android device, type in on the host PC:
* devices  -  list connected devices<br/>
+
<pre>
* shell  -  run command line shell<br/>
+
user@android $ export ADBHOST=<Android-device-IP-address>
* logcat  -  view Android log<br/>
+
user@android $ adb kill-server
 +
user@android $ adb start-server
 +
user@android $ 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 ==
+
= ADB over USB =
* Properly configure a Linux PC workstation, i.e.<br/>
+
* Properly configure a Linux PC workstation, e.g. on Ubuntu this should be:
    echo SUBSYSTEM==\"usb\", ATTR{idVendor}==\"18d1\", MODE=\"0666\", GROUP=\"plugdev\" >> /etc/udev/rules.d/51-android.rules
+
<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 in Android command line:
+
 
    $ getprop service.adb.tcp.port
+
* 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:
    $ setprop service.adb.tcp.port -1
+
<pre>user@android $ setprop service.adb.tcp.port -1</pre>
 +
 
 
* In Android graphic user interface enable ''Settings->Developer options->USB debugging''.
 
* In Android graphic user interface enable ''Settings->Developer options->USB debugging''.
* Connect a USB cable from the PC workstation to the CM-FX6 USB device jack - P48.<br/>At this point ''adb devices'', run on the PC workstation should list your device among attached devices.
+
* 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.
 +
 
 +
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 <argsuments>
 +
</pre>
  
===Access Android device via ADB===
+
= See Also =
Type in on host PC:
+
* [http://developer.android.com/tools/help/adb.html Android developer network]
    $ adb devices    # optional
+
* [http://developer.android.com/sdk/index.html Android SDK]
    $ adb <args...>
 
  
 
[[Category:Android|ADB setup]]
 
[[Category:Android|ADB setup]]

Revision as of 11:54, 9 June 2013

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:

user@android $ export ADBHOST=<Android-device-IP-address>
user@android $ adb kill-server
user@android $ adb start-server
user@android $ 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.
  • 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.

To access the Android device, type in on the PC workstation:

user@android $ adb kill-server
user@android $ adb start-server
user@android $ adb <argsuments>

See Also