Android: Getting "Manifest Merger Failed" Error After Updating to a New Version of Gradle

Manifest merger failed targeting Android 12

The issue was caused by 3 activities missing the android:exported attribute in the androidx.test:core library version 1.3.0. Upgrading to version 1.4.0-beta01 fixed the issue.

If you are getting errors after targeting Android 12, the easiest way to debug this is to:

  • downgrade to a prior sdk version
  • rebuild project
  • after a successful build, open your project's AndroidManifest.xml.
  • at the bottom of the window, click on the Merged Manifest tab
  • look for any <activity> that includes an <intent-filter> tag and is missing the android:exported attribute

If you want to make sure these activities are the issue, add them directly to your project's AndroidManifest.xml file with the missing android:exported attribute added and try rebuilding the project.

So if <activity android:name="com.domain.ProblemActivity"> is missing the android:exported attribute, add it to your AndroidManifest.xml file like so:

<activity 
android:name="com.domain.ProblemActivity"
android:exported="true" >

Rebuild targeting Android 12 and if it works, then you found the bug!

Thanks @MikePenz for pointing me in the right direction.

How to Solve 'Manifest merger failed' error in android-studio?

I have regenerate this error :

You have selected minSdkVersion to 1 while you created project.

as well as you are using :

compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'

due to this error occurs.

suggestion by android-studio :

use android.support.v7.appcompat

solution : change in gradle

minSdkVersion 7

Manifest merger failed error in Android gradle

It because you are using a different library for android. Made refactor to AndroidX packages for all library

With this

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// additional libraries
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1'
implementation 'androidx.room:room-runtime:2.1.0-alpha03'
annotationProcessor "androidx.room:room-compiler:2.1.0-alpha03"
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'

to this

//Android support libraries.
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'

implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'

As of Support Library and AndroidX Library are diffrent one. So use only one type of library.

Android Studio error: Manifest merger failed: Apps targeting Android 12

You need to specify android:exported="false" or android:exported="true"

Manifest:

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

as mentioned in the document:

If your app targets Android 12 and contains activities, services, or
broadcast receivers that use intent filters, you must explicitly
declare the android: exported attribute for these app components.

Warning: If an activity, service, or broadcast receiver uses intent
filters and doesn't have an explicitly-declared value for
android:exported, your app can't be installed on a device that runs
Android 12.

Also check when to use true/false for the 'android:exported' value.

Manifest merger failed with multiple errors , android

It looks like you are using the wrong config:

Since WorkManager 2.6, App Startup is used internally within WorkManager. To provide a custom initializer you need to remove the androidx.startup node.

<!-- If you want to disable android.startup completely. -->
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove">
</provider>

https://developer.android.com/topic/libraries/architecture/workmanager/advanced/custom-configuration#remove-default

Flutter When running app on Android a Manifest Merger failed error: different values is found

I was able to recreate your problem it seems that you need to sync your package name across multiple AndroidManifest.xml files.

enter image description here

Try to update this 3 AndroidManifest.xml files:

enter image description here

Manifest merger failed error

Give this a try:

Add this to <manifest/>

xmlns:tools="http://schemas.android.com/tools"

Add this to <application/>

tools:node="replace"

Based on this, it should override all the elements. "Replace the lower priority declaration with the annotated one."



Related Topics



Leave a reply



Submit