Tell us which versions you are using:
Tell us to which platform this issue is related
When calling ImagePicker.openCamera function, camera opens and allows to take a picture and crop it.
When calling ImagePicker.openCamera function, camera doesn't open and an error is thrown
Error: Failed to find configured root that contains /storage/emulated/0/Pictures/image-5d11ba49-be20-4bff-886a-1521499286f65949597546542086956.jpg
Install react-native-image-crop-picker
Call ImagePicker.openCamera function
https://github.com/ivpusic/react-native-image-crop-picker/blob/master/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java#L304 this is the line that fails.
Hello! For some time I've been using react-native-image-crop-picker without any issues (thanks for your great work), but now, I stumbled upon some kind of regression which doesn't allow me to take pictures anymore. The error I posted is basically all that's there. It is thrown When ImagePicker.openCamera is called. Here's a piece of my build.gradle setup:
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.myid.android"
minSdkVersion 16
targetSdkVersion 23
versionCode 7
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
}
any help would be highly appreciated since this issue prevents me from app release.
Thanks in advance!
Of course, I found a solution after hours of trying and finally posting here. For anyone having this problem in the future, adding this to AndroidManifest.xml (make sure that you place it in
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
and under android/app/src/res/xml/provider_paths.xml set
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
and it should be all good.
@brzezinskip thanks man, I already had a provider because I use react-native-sahre.
adding <external-path name="external_files" path="."/> to my filepaths.xml file fixed this issue for me.
Most helpful comment
Of course, I found a solution after hours of trying and finally posting here. For anyone having this problem in the future, adding this to AndroidManifest.xml (make sure that you place it in tags!!)
and under
android/app/src/res/xml/provider_paths.xmlsetand it should be all good.