Nix Nix - 19 days ago 69
Android Question

Error while Running Activity must be exorted or contain an intent-filter

I am getting this error while running the MainActivity or App.

enter image description here

Main AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>




<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity" />
<intent-filter >
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<service
android:name=".DelayedMessageService"
android:exported="false" >

</service>
</application>

</manifest>


My Android version: 2.2.2
I tried to Invalidate cache & restart, but it didn't help. Did follow few other tutorials but that didn't help either.
P.S: I am trying to execute IntentService from my MainActivity.

Answer

You closed your activity tag too early without including intent filter in it. Instead of <activity android:name=".MainActivity" /> try this

<activity android:name=".MainActivity">
    <intent-filter >
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
Comments