Android: ADB setup

From Compulab Mediawiki
Revision as of 15:48, 14 February 2013 by Andreyg (talk | contribs) (ADB over USB)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Android Debug Bridge is an interface and a command line utility that provides low level control of an Android powered device (physical or emulated).
To name a few of its features -

  • command line shell
  • installed package management
  • IDE interface for application development

Refer to Android developer network for more details.

Getting ADB

ADB is provided in the Android SDK.
To get a prebuilt version of ADB (for Linux/OSX/Windows) proceed to the Downloads section.

ADB over IP

ADB over IP is set up by default on CM-FX6.
It can be set by executing the following Android command line:

   $ setprop service.adb.tcp.port 5555

Access Android device via ADB

Type in on host PC:

   $ export ADBHOST=<Android-device-IP-address>
   $ adb kill-server
   $ adb start-server
   $ adb <args...>

Among useful args are

  • devices - list connected 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, i.e.
   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 in Android command line:
   $ getprop service.adb.tcp.port
If there is a value, and it is not -1 - it should be set to -1:
   $ setprop service.adb.tcp.port -1
  • 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.
    At this point adb devices, run on the PC workstation should list your device among attached devices.

Access Android device via ADB

Type in on host PC:

   $ adb devices    # optional
   $ adb <args...>