Archive for May, 2010

How to connect your Android phone to Ubuntu to do development, testing, installations or tethering

If you do any Android development in Ubuntu it is much better to test your applications on a real device rather than just relying on the emulator.

If you just connect the phone to the computer through USB and run adb devices you will find out that your phone is not recognized:

$ adb devices
List of devices attached
???????????? no permissions

This is easily fixable in Ubuntu. You have to add a line to a file in the /etc/udev/rules.d directory.

What line in which file depends on the manufacturer and model of the device. You can find out the Vendor ID number and Product ID number of the device by running (after you connected it via USB of course):

$ lsusb

For example, if you had a Nexus One connected you would get:

Bus 002 Device 004: ID 18d1:4e12

In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. Please keep in mind that the Vendor ID for HTC changed from “0bb4″ to “18d1″. The older HTC phones like the G1 have a Vendor ID of “0bb4″.

Here is how to set up some of the major Android phones:

Step 1. Enable Unknown sources and USB debugging:

Go to Settings -> Applications and check the Unknown sources check-box, then go to Development and enable the USB debugging.

Step 2. Depending on your phone follow these instructions:

  • G1
    Create/edit a file in /etc/udev/rules.d called 51-android.rules:

    $ sudo gedit /etc/udev/rules.d/51-android.rules

    Add the following line to it and save it:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c01″, MODE=”0666″

  • HTC Hero

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c02″, MODE=”0666″

  • HTC EVO

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c8d”, MODE=”0666″

  • HTC EVO Shift

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0ca5″, MODE=”0666″

  • HTC ThunderBolt

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0ca4″, MODE=”0666″

  • LG OPTIMUS LG-P506

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”1004″, ATTRS{idProduct}==”618e”, MODE=”0666″

  • Motorola Xoom

    Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8″, ATTRS{idProduct}==”70a9″, MODE=”0666″

  • Motorola Droid
    Create/edit a file in /etc/udev/rules.d called 10-motorola-droid.rules:

    $ sudo gedit /etc/udev/rules.d/10-motorola-droid.rules

    Add the following line to it and save it:

    SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8″, ATTRS{idProduct} ==”41db”, MODE=”0600″

  • Nexus One
    Create/edit a file in /etc/udev/rules.d called 99-android.rules:

    $ sudo gedit /etc/udev/rules.d/99-android.rules

    Add the following line to it and save it:

    SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″

Step 3. Restart udev:

$ sudo restart udev

Check if the device is recognized:

$ adb devices

You may need to stop and start the adb server:

$ adb kill-server
$ adb start-server

Update: Please note that some devices require to disconnect the usb cable at this point and then reconnecting it.

You should be good to go…

Wednesday, May 12th, 2010 Android, Eclipse, Java 61 Comments

Search

 

Archive

May 2010
M T W T F S S
« Jan   Jun »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Other