Android sample app not showing up

家住魔仙堡 提交于 2019-12-20 01:05:32

问题


New Android developer here. I'm following a tutorial at http://www.vogella.de/. The first applications (does temperature conversion) works. The second (does preferences and uses a menu) one never shows up. I've tried using both Helios and Galileo. I've tried re-installing Android SDK. I've tried removing the test device and re-creating it. Others say this tutorial works.

When the other app works, it doesn't get the two lines "No Launcher activity found!" and "The launch will only sync the application packages on the device."

What I see:

------------------------------
...] Android Launch!
...] adb is running normally.
...] No Launcher activity found!
...] The launch will only sync the application package on the device!
...] Performing sync
...] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'TestDevice'
...] Uploading de.vogella.android.preferences.apk onto device 'emulator-5554'
...] Installing de.vogella.android.preferences.apk...
...] Success!
...] \de.vogella.android.preferences\bin\de.vogella.android.preferences.apk installed on device
...] Done!

UPDATE: here is the text from my Android manifest file

<manifest 
    xmlns:android="schemas.android.com/apk/res/android";
    package="de.vogella.android.preferences" 
    android:versionCode="1" 
    android:versionName="1.0"> 
    <application android:icon="@drawable/icon" android:label="@string/app_name"> 
        <activity android:name=".HelloPreferences" android:label="@string/app_name">
        </activity> 
        <activity android:label="Preferences" android:name="Preferences">
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="8" />
</manifest>

回答1:


Here's the answer, which I had to find elsewhere. It seems that you must have the following element:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

inside your AndroidManifest.xml file. Once I added this, then right-clicked on the project name to launch the Android Application, the app then showed up in the menu panel.

Eclipse put this (intent-filter) element there for my first experimental application, but it did not do me the favor for the second one I created, which I'm still debugging for yet other (and probably Eclipse-related) reasons. (I probably filled something out wrong when creating the new Android project.)



来源:https://stackoverflow.com/questions/3347569/android-sample-app-not-showing-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!