Friday, October 5, 2012

Setting up adb on Linux for android development


Taken from - http://developer.android.com/tools/device.html#setting-up

Setting up a Device for Development


With an Android-powered device, you can develop and debug your Android applications just as you would on the emulator. Before you can start, there are just a few things to do:
  1. Declare your application as "debuggable" in your Android Manifest.
    When using Eclipse, you can skip this step, because running your app directly from the Eclipse IDE automatically enables debugging.
    In the AndroidManifest.xml file, add android:debuggable="true" to the <application> element.
    Note: If you manually enable debugging in the manifest file, be sure to disable it before you build for release (your published application should usually not be debuggable).
  2. Turn on "USB Debugging" on your device.
    On the device, go to Settings > Applications > Development and enable USB debugging (on an Android 4.0 device, the setting is located in Settings > Developer options).
  3. Set up your system to detect your device.
    • If you're developing on Windows, you need to install a USB driver for adb. For an installation guide and links to OEM drivers, see the OEM USB Drivers document.
    • If you're developing on Mac OS X, it just works. Skip this step.
    • If you're developing on Ubuntu Linux, you need to add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. For a list of vendor IDs, see USB Vendor IDs, below. To set up device detection on Ubuntu Linux:
      1. Log in as root and create this file: /etc/udev/rules.d/51-android.rules.
        Use this format to add each vendor to the file:
        SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

        In this example, the vendor ID is for HTC. The MODE assignment specifies read/write permissions, and GROUPdefines which Unix group owns the device node.
        Note: The rule syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules.
      2. Now execute:
        chmod a+r /etc/udev/rules.d/51-android.rules
When plugged in over USB, can verify that your device is connected by executing adb devices from your SDKplatform-tools/ directory. If connected, you'll see the device name listed as a "device."
If using Eclipse, run or debug your application as usual. You will be presented with a Device Chooser dialog that lists the available emulator(s) and connected device(s). Select the device upon which you want to install and run the application.
If using the Android Debug Bridge (adb), you can issue commands with the -d flag to target your connected device.

USB Vendor IDs

This table provides a reference to the vendor IDs needed in order to add USB device support on Linux. The USB Vendor ID is the value given to the ATTR{idVendor} property in the rules file, as described above.
CompanyUSB Vendor ID
Acer0502
ASUS0b05
Dell413c
Foxconn0489
Fujitsu04c5
Fujitsu Toshiba04c5
Garmin-Asus091e
Google18d1
Hisense109b
HTC0bb4
Huawei12d1
K-Touch24e3
KT Tech2116
Kyocera0482
Lenovo17ef
LG1004
Motorola22b8
NEC0409
Nook2080
Nvidia0955
OTGV2257
Pantech10a9
Pegatron1d4d
Philips0471
PMC-Sierra04da
Qualcomm05c6
SK Telesys1f53
Samsung04e8
Sharp04dd
Sony054c
Sony Ericsson0fce
Teleepoch2340
Toshiba0930
ZTE19d2
My set of commands were -

# sudo nano /etc/udev/rules.d/51-android.rules
Inside file: SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="robin"
# sudo chmod a+r /etc/udev/rules.d/51-android.rules


Verified by  -
# adb devices



No comments:

Post a Comment

I would be glad to know if this post helped you.