Resolve “Manifest Merger Failed” on Android 12
During android 12 migration, if you are seeing the “merged manifest” issue after following the steps mentioned here in the Android documentation, chances are you need to update your dependencies. The following steps worked for me and hope it works for you too. Cheers!
Downgrade
targetSdkVersionfrom 31 to 30Open
AndroidManifest.xmland tap on “Merged Manifest” tab at the bottom. More info here.Check the merged manifest file for any missing
android:exportedattribute.Add
android:exportedanywhere that’s applicable.If the missing attribute is not in your codebase’s
AndroidManifest.xmlbut in a dependency’sAndroidManifest.xmlthat is being used in the app, update the dependency version.Now upgrade the targetSdkVersion to 31 and compile your app.
One of the dependencies I had to update to support this migration was androidx.test:rules:XX