Equlo
Equlo

Reputation: 197

Android Studio Manifest - intent filter problem

Since I want to start my app with some animations. I need to start animation activity first. SplashActivity is animation activity.

In manifest I tried this:

   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.company.numberguessingapp"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="31" />

    <application
        android:allowBackup="true"
        android:appComponentFactory="androidx.core.app.CoreComponentFactory"
        android:debuggable="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:testOnly="true"
        android:theme="@style/Theme.NumberGuessingApp" >
        <activity
            android:name="com.company.numberguessingapp.SplashActivity"
            android:exported="true" /> 
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name="com.company.numberguessingapp.MainActivity"
            android:exported="true" >
        </activity>
    </application>
</manifest>

But I got this error:

A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction Android resource linking failed ERROR:/Users/kalilux/AndroidStudioProjects/NumberGuessingApp/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml:25: AAPT: error: unexpected element found in .

Line 25 is where is.

Upvotes: 1

Views: 1126

Answers (1)

Dev4Life
Dev4Life

Reputation: 3307

Thanks for posting the all of the Manifest code. There's actaully a mistake in closing a tag of an activity with intent-filter

You should type

<activity
    android:name="com.company.numberguessingapp.SplashActivity"
    android:exported="true"> 
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

instead of

<activity
    android:name="com.company.numberguessingapp.SplashActivity"
    android:exported="true" /> 
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Upvotes: 1

Related Questions