Search code examples
javaandroideclipsemanifestlauncher

No launcher activity found in eclipse java android


I'm getting something that looks like this:

"No Launcher activity found! The launch will only sync the application package on the device!"

I'm not sure how to fix this. My AndroidManifest looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.helloworld"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="20" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

    </application>


</manifest>

Any help would be greatly appreciated. Thanks!


Solution

  • You need to add the activity to your manifest. For example, if your initial activity is called MainActivity:

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.helloworld.MainActivity"
            android:label="Main Activity!" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    

    Edit: The above shows an activity that is also being used as a launcher. Here is an example of a regular activity also being added to the manifest.

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.helloworld.MainActivity"
            android:label="Main Activity!" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.helloworld.SecondActivity"
            android:label="My second activity"
            android:parentActivityName="com.example.helloworld.MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.helloworld.MainActivity" />
        </activity>
    </application>