How to set up a link betwteen a real Android cell and Ubuntu System by adb

This text will guide you how to set up a link with a real Android cell by adb.

You can install an unsigned *.apk to your real device or debug from your PC IDE with your real device.

This text has been proved by Ubuntu 9.10 (Karmic Koala) and Eclipse3.5.

Step 1, Build connection between Ubuntu and Device

1. Turn on "USB Debugging" on your device.
On the device, go to the home screen, press MENU, select Applications > Development, then enable USB debugging.

2. Add a rule file on your Ubuntu Linux
Login as root and create this file: /etc/udev/rules.d/51-android.rules.
edit the file to read:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

The text below provide a reference to the vendor IDs(because my cell is HTC G1 so I choose "0bb4"
Acer    0502
HTC    0bb4
Huawei    12d1
LG    1004
Motorola    Motorola
Samsung    04e8
Sony Ericsson    0fce

3. execute comands as follow:
$ adb kill-server
$ sudo adb start-server
$ adb devices

there will be a device name list like this:
"
List of devices attached
HT850GZ65731    device
"

If you encounter some trouble like "permission deny" or "device(HT850GZ65731) offline"
try to execute commands as follow:
$ sudo /etc/init.d/udev restart
$ sudo service udev restart
then input command
$ adb devices
to check whether you have build a link with device, if it still does not work, restart your system is the
last recommendation I might suggest.

Step 2 install your apk file to a device

change directory to your project directory/bin, there is a apk file that Eclipse has built for you.
execute command :
$ adb install abc(your app).apk
for instance:
$ adb install TrafficMap.apk
you will be list some information like this:
110 KB/s (318547 bytes in 2.809s)
    pkg: /data/local/tmp/TrafficMap.apk
Success

Step 3 debug your program on your device
Declare your application as "debuggable" in your Android Manifest.
In Eclipse, you can do this from the Application tab when viewing the Manifest (on the right side, set Debuggable to true). Otherwise, in the AndroidManifest.xml  file, add android:debuggable="true" to the <application> element.

That's all. Enjoy your ubuntu, enjoy your android, and welcome to android andventure.

Summrized by Benjamin Qi
Intern of Beijing PalmCity Science and Technology Co., Ltd
MSN: [email protected]
2009/12/15 night

你可能感兴趣的:(android,debug,ubuntu,adb,device)