Android: adb

From ARMWorks
Jump to: navigation, search

Android > adb

adb is the Android Debugging Bridge which can be used for a variety of tasks, notably debugging and installing applications.

Prerequisites

  • android-tools-adb (Probably in your Linux distro's repos)

Install

For Debian, the package was in the Wheezy-Backports repo.

   # sudo vim /etc/apt/sources.list

Add this line.

   deb http://ftp.us.debian.org/debian  wheezy-backports main

Update apt and install.

   # sudo apt-get update
   # sudo apt-get install -t wheezy-backports android-tools-adb


Create udev rule

You'll want to make a udev rule, so you don't need to be root to use adb. First we need to know the vendor id of the device, run.

   # lsusb
   ...
   Bus 001 Device 006: ID 18d1:4e22 Google Inc. Nexus S (debug)
   ...

Here the vendor id is 18d1

Create a new rules file.

   # sudo vim /etc/udev/rules.d/51-android.rules

With this line in it

   SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

Change rules permissions and reload the rules.

   # sudo chmod 644 /etc/udev/rules.d/51-android.rules
   # sudo udevadmin control --reload-rules

You should be able to use adb as a regular user now. To test it out, plug in your board with Android booted up to the USB and run

   # adb devices
   
   * daemon not running. starting it now on port 5037 *
   * daemon started successfully *
   List of devices attached 
   0123456789ABCDEF	device

Errors

cannot bind 'local:5037'

Check in the /tmp directory for a file named 5037, if present, delete it.


?????????????? (no permission)

You may need to start the adb server as root, run.

   # sudo adb kill-server
   # sudo adb start-server
   # adb devices