I've faced this issue when I tried to install react-native-share while having react-native-image-crop-picker installed.
I've already solved this by my side but it can be solved by making minor changes in the library.
Tell us which versions you are using:
Tell us to which platform this issue is related
Android app building without errors
Build error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
install react-native-image-crop-picker
install react-native-share
build android app
Now, to fix this issue I had to create a subclass of FileProvider and point my AndroidManifest provider tag to it instead of android.support.v4.content.FileProvider
provider needed by react-native-share that you have to add into your projects AndroidManifest:
(located at android/app/src/main/AndroidManifest.xml inside application tag)
<provider
android:name=".MyFileProvider" // this was pointing to android.support.v4.content.FileProvider
android:authorities="${applicationId}.provider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
filepaths.xml (located at android/app/src/main/res/xml/filepaths.xml)
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="myexternalimages" path="Download/" />
<external-path name="external_files" path="."/> // without this, openCamera falls into catch
</paths>
MyFileProvider.java (located at android/app/src/main/java/com/YOUR_PROJECT/MyFileProvider.java
package com.YOUR_PROJECT;
import android.support.v4.content.FileProvider;
public class MyFileProvider extends FileProvider {
}
I found the solution in this github issue and the solution of the libraries maintainer in this SO question.
All this library has to do is to follow the steps above in the libraries android project and future generations won't face this issue when using react-native-share with this library together.
Woops, reopening so the maintainers won't overlook this. Can be closed when noticed by maintainers.
xmlns:tools="http://schemas.android.com/tools"
..........
android:authorities="${applicationId}.provider"
android:grantUriPermissions="true"
android:exported="false">
tools:replace="android:resource"//------------------------------add this line
android:resource="@xml/filepaths" />
I don't know well how tools:replace is working but build error is disappeared by adding this line.
Build error disappeared, but the image crop picker is not working now. The FileProvider in my application works fine
Most helpful comment
xmlns:tools="http://schemas.android.com/tools"
android:name="android.support.v4.content.FileProvider"
android:name="android.support.FILE_PROVIDER_PATHS"
..........
android:authorities="${applicationId}.provider"
android:grantUriPermissions="true"
android:exported="false">
tools:replace="android:resource"//------------------------------add this line
android:resource="@xml/filepaths" />
I don't know well how tools:replace is working but build error is disappeared by adding this line.