Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported`

Viewed 16244

Please help me with this error getting in my project while trying to run at mobile via android studio.

Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

7 Answers

I found this solution!!.

So you have to add the android:exported="true" into the activity tag in the manifest (not in the application).

<application
        android:fullBackupContent="@xml/my_backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name">
        <activity android:name=".yourActivity" android:exported="true">

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

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

    </application>

To see more information about the exported property, see App manifest file activity

:)

Add this to your manifest to the activity tag in the error message:

android:exported="true"

This happens when your activity can be started by another application. For example image viewer can be started by file manager when clicking an image. The image viewer app is "exported".

It's also always required if you are using the following code necessary for dynamic links:

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

Example:

    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
       
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

If you have any activity, service, receiver, or provider that does not have exported set in your manifest file then add whenever it needed like,

android:exported="false or true"

You had to figure out the component missing the Android exported tag. You should downgrade your SDK version and check the final merged manifest file for the components missing the exported tag but has IntentFilter.

The step-by-step instructions is provided in this link.

if you are using flutter ,may some deprecated lib in your ap is causing this .. for me: upgrading flutter_local_notifications to the latest version (now is 9.3.2) solved this error..

This is for the projects using Bootsplash. My project used Bootsplash and I solved it by adding android:exported="true" also to the activity of Bootsplash in the AndroidManifest file.

<application
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustPan"
    android:exported="true"                   // <----ADD THIS
    android:screenOrientation="portrait">
    
  </activity>
   <activity
    android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
    android:theme="@style/BootTheme"
    android:exported="true"                    // <----ADD THIS
    android:launchMode="singleTask">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
</application>

Add android:exported="true" into the Manifest file inside of the application activity

<application
    <activity
        android:exported="true"
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.NoteKeeper.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
Related