2

I've explored a lot and i found out that in all the activities we need to specify the android:exported parameter. I've added the param in all my activities in manifest, but i'm still getting this error.

Manifest merger failed : android:exported needs to be explicitly specified for <activity>. 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.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.soptle">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:roundIcon="@drawable/icon"
        android:usesCleartextTraffic="true"
        android:supportsRtl="true"
        android:theme="@style/Theme.Soptle">
        <activity
            android:name=".ManufacturerDetailsActivity"
            android:exported="true" />
        <activity
            android:name=".NotificationActivity"
            android:exported="true" />
        <activity
            android:name=".SearchActivity"
            android:exported="true" />
        <activity
            android:name=".UpdateUserInfoActivity"
            android:exported="true" />
        <activity
            android:name=".OTPverificationActivity"
            android:exported="true" />
        <activity
            android:name=".ViewAllActivity"
            android:exported="true" />
        <activity
            android:name=".MyAddressesActivity"
            android:exported="true" />
        <activity
            android:name=".AddAddressActivity"
            android:exported="true" />
        <activity
            android:name=".DeliveryActivity"
            android:exported="true" />
        <activity
            android:name=".OrderDetailsActivity"
            android:exported="true" />
        <activity
            android:name=".ProductDetailsActivity"
            android:exported="true" />
        <activity
            android:name=".CategoryActivity"
            android:exported="true" />
        <activity
            android:name=".HomeActivity"
            android:exported="true"
            android:label="@string/title_activity_home"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Soptle.NoActionBar" />
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.SplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <meta-data
            android:name="preloaded_fonts"
            android:exported="true"
            android:resource="@array/preloaded_fonts" />
    </application>

</manifest>
Ryan M
  • 18,333
  • 31
  • 67
  • 74
  • Could it be an activity in one of the dependencies? maybe try upgrading all your dependencies – Ivo Nov 30 '21 at 12:23
  • Check your merged manifest (Android Studio has a button for this on the bottom if you open your manifest) and see if there are any activities / services from dependencies which do not specify the exported tag. Overwrite them if you find any: https://stackoverflow.com/questions/69925501/android-how-can-i-override-exported-tag-in-manifest – Alexander Hoffmann Nov 30 '21 at 12:46
  • not everything in your manifest needs to `android:exported="true"` to be added. Add that only where the *Intent-Filter* is applied. – Noah Dec 01 '21 at 05:27
  • This worked for me https://stackoverflow.com/questions/67654506/manifest-merger-failed-targeting-android-12/67668116#67668116 – Yuri Schimke Dec 07 '21 at 16:51

1 Answers1

2

adding android:exported="true" to the activity with intent filter in manifest.xml soled the problem for me

Lucky Amos
  • 156
  • 1
  • 5