Wednesday, December 1, 2010

Android Development on Linux using Huawei U8100


Android SDK and eclipse is very easy to setup. Google has tonnes of very good tutorials on how to get started with Android on different platforms (including Linux).

Since I own a Huawei U8100 android phone, I planned to use the phone as the android device (instead of an emulator).
So I followed the instruction to create the rules file in /etc/udev/rules.d/99-android.rules
containing the following text:
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", OWNER="khaledm" GROUP="khaledm"

If you have read the Google's device setup instruction, you must have observed few differences:
1. Filename starting with 99: this makes sure that this rule is one of the last ones to be executed.
2. OWNER="khaledm" GROUP="khaledm" instead of MODE="0666" : gives only permission me to communicate with the device.

When I tried to run a HelloWorld application on Huawei U8100, this is what I saw on eclipse:


and guess what?
Eclipse fails to upload the application on my device:
[2010-12-01 22:07:02 - HelloAndroid] Uploading HelloAndroid.apk onto device '????????????'
[2010-12-01 22:07:02 - HelloAndroid] Failed to upload HelloAndroid.apk on device '????????????'
[2010-12-01 22:07:02 - HelloAndroid] com.android.ddmlib.AdbCommandRejectedException: device not found
[2010-12-01 22:07:02 - HelloAndroid] Launch canceled!

Digging in further, I tried using adb to list the available devices, here is what I get:
khaledm@madinatek:~$ adb devices
List of devices attached
???????????? device
emulator-5554 device

So, it looks like adb is having difficulty recognizing my device. But when I tried Acer Liquid E, it worked like a charm.
khaledm@madinatek:~$ ./android-devel/android-sdk-linux_x86/tools/adb devices
List of devices attached
emulator-5554 device
???????????? device
0000023459713769device

Listing the usb devices
khaledm@madinatek:~$ lsusb
Bus 002 Device 009: ID 12d1:1035 Huawei Technologies Co., Ltd.
Bus 001 Device 008: ID 0502:3202 Acer, Inc.
and comparing the output of
sudo udevadm info --attribute-walk --name=/dev/bus/usb/002/009
and
sudo udevadm info --attribute-walk --name=/dev/bus/usb/001/008

we see that Huawei U8100 is missing ATTR{serial} among other things:
Acer Liquid E's: ATTR{serial}=="0000023459713769"

I have not tried on Windows, so can't really blame Linux for not being able to detect the serial #. I have tried two different Huawei U8100 on Linux (Ubuntu 10.10), experiencing the same behavior.

Fortunately, I found a work around to this problem. The serial # is used by adb when multiple devices are present. So as long as I have only a single Huawei U8100 attached to my machine (and no emulator), I can use the command line to install an app:
adb install ./workspace/HelloAndroid/bin/HelloAndroid.apk
271 KB/s (15481 bytes in 0.055s)
pkg: /data/local/tmp/HelloAndroid.apk
Success

Happy hacking!
By the way, if you are aware of a fix to this issue, please let me know.

9 comments:

TimeZone said...

Do this on Terminal App on device: echo 22>/sys/devices/platform/msm_hsusb_periphera/fixusb

Libro para Compiladores said...

Fantastic TimeZone !! This command you post fixed the problem !!
Thank you very much !!

GaMaL said...

I'm running mac i enabled usb debug and i can't get my Huawei u8100 listed, any idea why ?

kholy said...

not working here either, I am on Ubuntu 10.04 , either getting no permission when running adb as normal user, when running it as root, the device is not detected

Anonymous said...

Im on a mac too. Same issue. I have tried installing Mobile Connect, but no go. Perhaps we need drivers?

sandy said...

I am trying for android development setup on mac with huawei U8100 device but adb is not even listing my device. any luck with this device?

Kamilos said...

@TimeZone: Amazing! I am curious, what the problem was and why this command fixes it?

Kamilos said...

@TimeZone: Amazing! I am curious, what the problem was and why this command fixes it?

Unknown said...

Hi, sorry for my english but TimeZone solution doesn't work on my phone.

msm_hsusb_periphera doesn't exist.

I only have msm_hsusb.

I'm on U8100, without Original rom.

Thaaanks! :D