1

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?

  • 2
    Check your merged manifest, such as via the "Merged Manifest" tab in the Manifest editor in Android Studio. Perhaps there is a third-party library that you are using that is contributing a component that is missing this attribute. – CommonsWare Sep 25 '21 at 19:45
  • @CommonsWare I use only compose and androidx.lifecycle:lifecycle-viewmodel-ktx. But I will check thanks. – Vadym Yaroshchuk Sep 25 '21 at 19:59
  • @CommonsWare is there any way to check it in Intellij Idea? Because I cannot build project in AS (I got "unknown error") – Vadym Yaroshchuk Sep 25 '21 at 20:52
  • There appears to be a "Merged Manifest" sub-tab in the manifest editor in IDEA (tested on version 2021.2.2). – CommonsWare Sep 25 '21 at 21:05
  • @CommonsWare I found `androidx.test.core` without such value, but what shall I do with it? I didn't add it to dependencies – Vadym Yaroshchuk Sep 28 '21 at 15:54
  • That should be only for tests (instrumented tests or unit tests), so I would be surprised if it is causing a problem in a regular build. If you are sure that it is, you would need to use something like a Gradle dependency report to see what you are depending on that has `androidx.test.core` as a transitive dependency. – CommonsWare Sep 28 '21 at 15:55
  • @CommonsWare ohhh, ye that's my mistake. I found compose tests dependency. But it is a bit surprising that they are not up to date for 12 android (I have latest alpha version) – Vadym Yaroshchuk Sep 28 '21 at 16:01

2 Answers2

3

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.

0

most likely because of react-native version. I had same issue on react-native 0.63.4, but no error on react-native 0.66.4