2012-02-06

開發Android in Ubuntu 注意事項 - USB Debug


主要參考
http://developer.android.com/guide/developing/device.html
另外還要參考
http://www.cnblogs.com/xiaobo68688/archive/2011/10/18/2216824.html

Step1
In the AndroidManifest.xml file, add android:debuggable="true" to the <application> element.
Step2
On the device, go to Settings > Applications and enable Unknown sources (on an Android 4.0 device, the setting is located in Settings > Security).
Step3
On the device, go to Settings > Applications > Development and enable USB debugging (on an Android 4.0 device, the setting is located in Settings > Developer options).
Step4
在ubuntu 命令模式
4.1 => vim /etc/udev/rules.d/51-android.rules
4.2 => 查一下手機vendorID http://developer.android.com/guide/developing/device.html#VendorIds
4.3 => 輸入 SUBSYSTEM=="usb", ATTR{idVendor}=="####", MODE="0666", GROUP="plugdev"
[註] ####請填入該手機vendorID
4.4 => 存檔離開
4.5 => chmod a+r /etc/udev/rules.d/51-android.rules
4.6 => sudo /etc/init.d/udev restart
4.7 => 進入 android-sdks/platform-tools/
4.8 => sudo ./adb kill-server
4.9 => sudo ./adb devices
可以看看你的手機是否在清單中了

1 意見:

Unknown 提到...

現在每次插入手機usb 都要做以下動作 ubuntu才會認得

1. 去 android-sdk/platform-tools下

2. 執行 sudo ./adb kill-server

3. 執行 sudo ./adb devices

這樣才會抓到手機