Difference between revisions of "Android: ADB setup"

From Compulab Mediawiki
Jump to: navigation, search
(ADB over USB)
 
 
(2 intermediate revisions by one other user not shown)
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/>
+
root@ubuntu $ export ADBHOST=<Android-device-IP-address>
* logcat  -  view Android log<br/>
+
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 ==
+
= 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''.
+
 
* 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.
+
* 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>
  
===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]]

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.
Admolition note.png 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>

See Also