2.確認adb(D:\eclipse\android sdk\platform-tools)有無在環境變數下
-adb主要用來除錯用
3.於eclipse android專案下,於AndroidManifest.xml的<activity ... > 加入android:debuggable="true"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...略
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MyHelloWorldActivity"
android:label="@string/app_name"
android:debuggable="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
...略
</manifest>
4.手機上,將設定 → 應用程式 → 開發 → USB 除錯 打勾
理論上,執行完這4個步驟就可以了。但我在執行時,還遇到eclipse跳出error
[2012-04-24 14:08:48 - MyHelloWorld] Please execute 'adb uninstall com.example' in a shell.
[2012-04-24 14:08:48 - MyHelloWorld] Launch canceled!
照做,就成功囉!
參考
走不到的世界線
Tsung's blog
android developer
沒有留言:
張貼留言