'Manifest merger failed : android:exported needs to be explicitly specified for <activity>
I have a problem with a manifest file, error message:
Manifest merger failed : android: exported needs to be explicitly specified for . 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.
My AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyTheme">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:exported="true"
android:name=".Activities.SplashScreenActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
</activity>
</application>
</manifest>
This post describes a solution but it doesn't work or I made something wrong. Maybe anyone has a similar problem, please let me know how to resolve that.
Solution 1:[1]
- downgrade or upgrade to a prior sdk version then rebuild the project.
- open your project's
AndroidManifest.xml
. - click on the Merged Manifest tab [at the bottom of the window]
- find out which
<activity>
that includes an<intent-filter>
tag is missing theandroid:exported
attribute - if found then right-click and press
Go to Declaration
then addandroid:exported
attribute to the activity tag - Rebuild the project
Hope it will work. It works for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lahiru Chandima |