Debugging Your Android Application on the G1 (Or Any HTC Android Device) in Ubuntu 9.04
- 9
- Add a Comment
I have a T-Mobile G1, did I tell you? Anyways, I became interested in developing with the G1, so I am currently in the process of relearning Java (which will also come in handy Sophmore year). I was reading through the pages on Android’s Developer site when I came across a page that tells you how to debug your Android application on a physical device, rather than the emulator included in the SDK. I ran through the steps but I could not get Ubuntu to see my device. Then I figured it was some compatibility issue. After all, the latest Ubuntu version they had steps for was for Hardy. Their directions are as follows:
1. Login as root and create this file: /etc/udev/rules.d/50-
android.rules.
For Gusty/Hardy, edit the file to read:SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"For Dapper, edit the file to read:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"2. Now execute:
chmod a+rx /etc/udev/rules.d/50-android.rules
However, in Jaunty something has changed that causes this method to no longer work. After some searching around, I put together this method:
- Follow the above page’s directions completely.
- Take the file you created, and add “SYMLINK+=”android_adb”" as on of the arguments. The file should now look like:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", SYMLINK+="android_adb", MODE="0666" - Instead of the filename starting with fifty, use a higher number like fifty-one:
sudo mv /etc/udev/rules.d/50-android.rules /etc/udev/rules.d/51-android.rules
- Restart udev (kernel event manager) by using the command:
sudo /etc/init.d/udev restart
Now by running the adb tool in the SDK’s tools directory with the argument ‘devices’, you should see your Android device.
The number preceding the filename is actually the priority those rules are used by udev. The higher the number, the later it is run. Something in Jaunty was changed that caused those rules to be used too late or too early.
I performed this using my G1, so in the future if you are using a device other than the G1 or the Android Developer Phone, then you can find out the 4 character code that is used in the rules file (above it is 0bb4) by using the ‘lsusb’ command in your Ubuntu console. This will list all the USB devices currently connected to your system, including your Android device. On my Ubuntu machine, the line that refers to my phone reads:
Bus 001 Device 007: ID 0bb4:0c02 High Tech Computer Corp.
As you can see, the four character code you need in your rules file is stated in the output (the first half of the device’s ID).
Have any problems, see an error in this post, or just want to praise me for this post? Just leave a comment!



9 Comments
Anthony Di Iorio
June 10th, 2009
at 12:56pm
It is so cool that you are developing for a mobile device.
Eddie
June 10th, 2009
at 1:13pm
Well, right now I’m learning Java, but hopefully I can actually develop on Android soon.
Amn
August 4th, 2009
at 2:11am
Thank you, it’s very useful information
Android Tales » Blog Archive » ADB doesn’t see any Android devices under Ubuntu 9.04
September 8th, 2009
at 5:09am
[...] http://eddieringle.com/debugging-your-android-application-on-the-g1-or-any-android-device-in-ubuntu-... September 8th, 2009 in android, linux, ubuntu | tags: ADB, ubuntu [...]
How to Get Your Android-Powered T-Mobile G1 (HTC Dream) Recognized in Ubuntu 9.10 » One More Geek Blogger - Eddie Ringle
October 16th, 2009
at 6:15am
[...] on the settings you need to get your Android-powered device recognized by Ubuntu 9.04 (Jaunty) [eddieringle.com/debugging-your-android-application-on-the-g1-or-any-android-device-in-ubuntu-904/]. Now that 9.10 (Karmic) is almost ready for release, you will need some modifications to that udev [...]
Joey Wilson
December 25th, 2009
at 2:11am
Thank you for posting this!
don park
January 20th, 2010
at 5:25pm
thank you for this story! had reinstalled ubuntu and was trying to recreate the udev file. the android docs are wayyy out of date and this was a huge help.
I filed a bug to get the documentation updated. http://code.google.com/p/android/issues/detail?id=6164
Eddie
January 20th, 2010
at 6:35pm
Yeah, went ahead and replied to that with the 9.10 post as well.
Android Google
February 24th, 2010
at 9:08am
There’s an impressive amount of shipment statistics relating to Android. It does sound technologically exciting but the bugs just sound like a teething problem- it happens.
Rachel