如何将android例子程序添加到Eclipse进行调试运行
website:http://blog.csdn.net/whwzm88/article/details/6342583
1、打開Eclipse,選擇File->new->Android Project,如附圖所示窗口:
2、選擇Create project from existing source單選框,然后點擊->Browse..., 找到想要查看的android例子目錄:
備注:一般android例子位于android的SDK安裝目錄中的samples下面的各個android版本目錄,例如:android-sdk-windows/samples/android-8
3、選擇好后,工程名和android開發(fā)版本都會自動選擇上,點擊 finish,即可;
?
?常見問題:
?
錯誤信息:
[2011-04-22 16:26:16 - Home] ------------------------------
[2011-04-22 16:26:16 - Home] Android Launch!
[2011-04-22 16:26:16 - Home] adb is running normally.
[2011-04-22 16:26:16 - Home] No Launcher activity found!
[2011-04-22 16:26:16 - Home] The launch will only sync the application package on the device!
[2011-04-22 16:26:16 - Home] Performing sync
[2011-04-22 16:26:16 - Home] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'android1'
[2011-04-22 16:26:16 - Home] WARNING: Application does not specify an API level requirement!
[2011-04-22 16:26:16 - Home] Device API version is 8 (Android 2.2)
[2011-04-22 16:26:20 - Home] Application already deployed. No need to reinstall.
[2011-04-22 16:26:20 - Home] /Home/bin/Home.apk installed on device
[2011-04-22 16:26:20 - Home] Done!
[2011-04-22 16:29:01 - Home] ------------------------------
?
問題分析:根據(jù)紅色提示,說明沒有找到可運行的Activity
?
解決辦法:
打開AndroidManifest.xml清單文件,找到"?<action android:name="android.intent.action.MAIN" />"位置,
將"<category android:name="android.intent.category.LAUNCHER" />”添加進(jìn)去即可.
如下所示:
?<activity android:name="Home"
??????????????? android:theme="@style/Theme"
??????????????? android:launchMode="singleInstance"
??????????????? android:stateNotNeeded="true">
??????????? <intent-filter>
????????????????<action android:name="android.intent.action.MAIN" />
??????????????? <category android:name="android.intent.category.HOME"/>
??????????????? <category android:name="android.intent.category.DEFAULT" />
??????????????? <category android:name="android.intent.category.LAUNCHER" />
??????????? </intent-filter>
??????? </activity>
?
附圖:
總結(jié)
以上是生活随笔為你收集整理的如何将android例子程序添加到Eclipse进行调试运行的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 高效Java实现敏感词过滤算法工具包
- 下一篇: SwitchHost使用教程