Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manifest merger failed : android:exported needs to be explicitly specified for <service> even if there were no services in my AndroidManifest.xml file

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.

There are no <services in my app's AndroidManifest.xml file, I also looked for each AndroidManifest.xml file and they also don't have any <service element, so why am I getting this error?

There are no errors in my merged manifest tab, however, the first manifest has two <receiver and I've already added android:exported property manually in them.

enter image description here

like image 447
iDecode Avatar asked Sep 05 '21 22:09

iDecode


2 Answers

In app -> src -> main -> AndroidManifest.xml you need to explicitly add the Tag of android:exported="true" in each <Activity> under <Application>

<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.Eynetic">
    <activity android:name=".Splash_Screen"
        android:theme="@style/SplashTheme"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MainActivity"
        android:theme="@style/MainTheme"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

See the Activity Tag in the code...

<activity android:name=".Splash_Screen"
        android:theme="@style/SplashTheme"
        android:exported="true">

Currently i am doing it with each activity as that was the error given by Android studio but maybe there is a better way to add it only once somewhere in the code.

like image 54
M Tayyab Asghar Avatar answered Oct 23 '22 18:10

M Tayyab Asghar


Try adding android:exported = false pr android:exported = true in your own manifest file and compile the code. I hope this should solve you issue. As adding manually in notification will not work.

like image 40
Ankit Tale Avatar answered Oct 23 '22 16:10

Ankit Tale