第一步:安裝eclipse ;配置jdk;配置sdk路徑。安裝adt。。(這些都是android開發的前提。相信你已經做好)
第二步:
Declare your application as "debuggable" in your Android Manifest.
When using Eclipse, you can skip this step, because running your app directly fromthe Eclipse IDE automatically enables debugging.
In the AndroidManifest.xml
file, add android:debuggable="true"
tothe<application>
element.
第三步: 在手機裏找到開發者選項並打勾。
- Turn on "USB Debugging" on your device.
On the device, go to Settings > Applications > Development and enableUSB debugging (on an Android 4.0 device, the setting is located inSettings > Developer options).
第四步:創建文件51.android.rules文件。並作修改
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"
{idVendor
}是生產手機的公司。我的是nexus s ,屬於三星和google配出來的,三星是公,google是母的。 但是!!!生出的孩子是姓google的。。所以設備號是18d1。
USB Vendor IDs
This table provides a reference to the vendor IDs needed in order to add USBdevice support on Linux. The USB Vendor ID is the value given to theATTR{idVendor}
property in the rules file, as described above.
Company | USB Vendor ID |
---|---|
Acer | 0502 |
ASUS | 0b05 |
Dell | 413c |
Foxconn | 0489 |
Fujitsu | 04c5 |
Fujitsu Toshiba | 04c5 |
Garmin-Asus | 091e |
18d1 |
|
Hisense | 109b |
HTC | 0bb4 |
Huawei | 12d1 |
K-Touch | 24e3 |
KT Tech | 2116 |
Kyocera | 0482 |
Lenovo | 17ef |
LG | 1004 |
Motorola | 22b8 |
NEC | 0409 |
Nook | 2080 |
Nvidia | 0955 |
OTGV | 2257 |
Pantech | 10a9 |
Pegatron | 1d4d |
Philips | 0471 |
PMC-Sierra | 04da |
Qualcomm | 05c6 |
SK Telesys | 1f53 |
Samsung | 04e8 |
Sharp | 04dd |
Sony | 054c |
Sony Ericsson | 0fce |
Teleepoch | 2340 |
Toshiba | 0930 |
ZTE | 19d2 |
第六步:
打開eclipse,在eclipse中,選擇window -> show view -> other...->device 然後插上手機就可以識別了。然後右鍵你的工程選擇run as-> android application.這樣你的eclipse裏的android程序就可以在手機裏測試了。快去試試吧。
本文參照:開發者聯盟 http://developer.android.com/tools/device.html#VendorIds
--
Persist in the end and
never give up