Categories

Follow Us @web_learners

Monday, August 3, 2020

How to solve Manifest merger failed problem in Android Studio

Hi, In the last post we have learned that How to Restore Suspended Webview Apps on Google Play. Today we are going to learn How to solve "Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-20:19 to override." problem in Android Studio.



For solving the Manifest merger failed problem,  it has two methods to solve it.  Two methods are below:

The first method is:
1. Migrate your project to AndroidX project.

The second method is:
2. Don't need to Migrate the project to the AndroidX project. Write code in the Manifest file.

How to Migrate your project to AndroidX project

If you are using old android studio libraries then you have to migrate your project to the AndroidX project. For migrating to the AndroidX project you have to add the following two lines into the "Gradle.properties" file in android studio.
Code:
 
First, go to the "Gradle.properties" file, then paste the above two lines. then click on "Sync Now" See the below images for better understanding.



 or you can migrate your project following way also. First, click on Refactor from the above menu in Android studio. Then select on Migrate to AndroidX. 

After that you will get a confirmation window, you need to click on migrate. It will ask you to do backup your project before migrating to AndroidX.you should do the backup. Then it will migrate your project to AndroidX.



Second Method:

If you don't want to migrate your project to the AndroidX project, you can follow this second method for migrating to the AndroidX project. You need to just write below two lines of code in the Manifest file in the Android studio.
Code:
 

See below image:




After that just "Sync" your project. You will see the error is gone. That's it. Thank you.

The video tutorial of  "How to solve Manifest merger failed problem in Android Studio" is here


No comments:

Post a Comment