如何将android例子程序添加到Eclipse进行调试运行
website:http://blog.csdn.net/whwzm88/article/details/6342583
1、打開(kāi)Eclipse,選擇File->new->Android Project,如附圖所示窗口:
2、選擇Create project from existing source單選框,然后點(diǎn)擊->Browse..., 找到想要查看的android例子目錄:
備注:一般android例子位于android的SDK安裝目錄中的samples下面的各個(gè)android版本目錄,例如:android-sdk-windows/samples/android-8
3、選擇好后,工程名和android開(kāi)發(fā)版本都會(huì)自動(dòng)選擇上,點(diǎn)擊 finish,即可;
?
?常見(jiàn)問(wèn)題:
?
錯(cuò)誤信息:
[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] ------------------------------
?
問(wèn)題分析:根據(jù)紅色提示,說(shuō)明沒(méi)有找到可運(yùn)行的Activity
?
解決辦法:
打開(kāi)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进行调试运行的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 高效Java实现敏感词过滤算法工具包
- 下一篇: SwitchHost使用教程