Issue
When I'm trying to compile an APK file I get the next error:
dove\frontend\android\src\main\AndroidManifest.xml Error: 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.
I have such value, but AGP does not see it. My manifest with value:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dove.android">
<application
android:name=".DoveApplication"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="Dove"
android:supportsRtl="true"
android:theme="@style/Theme.Dove">
<activity
android:exported="true"
android:name=".AppActivity"
android:label="Dove"
android:theme="@style/Theme.Dove.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
AGP version: 4.2.2
Any workarounds except of downgrading targetSdk
?
Solution
All you need to do is open the manifest and select "Merged Manifest" in the bottom panel and look for the dependency that adds the activity without this property.
In my case, it was androidx.core.test
from compose unit tests.
Answered By - Vadim Yaroschuk
Answer Checked By - Clifford M. (JavaFixing Volunteer)