“Manifest merger failed with multiple errors, see logs” [How to Solve]

 

Problem description

The project merges the AAR of the third party, and the following errors are often reported:

Manifest merger failed with multiple errors, see logs

Solutions

Enter the following command in terminal of Android studio to print more detailed logs:

gradlew processDebugManifest -stacktrace

The implementation results are similar as follows:

C:\Users\alex\Desktop\***\app\src\main\AndroidManifest.xml:27:13-60 Error:
        Attribute provider#androidx.core.content.FileProvider@authorities value=(***.provider) from [AwePhotos_0.1.11.aar] AndroidManifest.xml:27:13-60
        is also present at [com.pgyersdk:sdk:3.0.10] AndroidManifest.xml:20:13-64 value=(***.fileProvider).
        Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:25:9-33:20 to override.
C:\Users\alex\Desktop\***\app\src\main\AndroidManifest.xml:32:17-51 Error:
        Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/file_paths) from [AwePhotos_0.1.11.aar] AndroidManifest.xml:32:17-51
        is also present at [com.pgyersdk:sdk:3.0.10] AndroidManifest.xml:25:17-55 value=(@xml/provider_paths).
        Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

For the rest, follow suggestion to eliminate errors

Remarks

Need to use“ tools:replace “The place to add should be at the same level as the property to be replaced
for example, prompt replacement“ android:authorities “, you need to add the following statement:

tools:replace="android:authorities"

Add in“ android:authorities “At the following level:

<provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                tools:replace="android:resource"
                android:resource="@xml/file_paths" />
        </provider>

 

Similar Posts: