Failed to find configured root that contains
Failed to find configured root that contains
Android: FileProvider IllegalArgumentException Failed to find configured root that contains /data/data/**/files/Videos/final.mp4
I am trying to use FileProvider to play a video from private path.Facing
Any clues on this?
3 Answers 3
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
change your provider XML to this.
I had the very same basic situation. I defined everything correctly (files-path in xml) but there is one more thing which leads to the same exception. I add another answer just as an addition and a comment would not be well readable.
I created/read the directory where i store the files like:
This leads to a path like:
Then i changed creating the directory to:
This leads to a path like:
According to the documentation Open a directory the two methods should be equivalent as far as i understand it. But it creates a different path. Maybe the formulation is just not clear for me in the documentation, but for me its wrongly written.
Creates a new directory (or opens an existing directory) within your app’s unique file system directory. This new directory appears inside the directory provided by getFilesDir().
java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/
Building basic app and getting IllegalArgumentException: Had a Button to launch camera app where I am trying to save image to pictures. dispatchTakePictureIntent(); method is called when I click Image button
Found few similar issues but that couldn’t resolve my issue:
Below is my code. Can some one help what I am missing?
file_paths.xml placed at res/xml/file_paths.xml
7 Answers 7
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
I think these is the right way
You can also use external-files-path (corresponding to /storage/emulated/0/com.androidapp.natty.catalogcreate/files/ directory), and then specify its Pictures directory. code shown below:
use file provider in manifest
and declare provider_path as mentioned below
It will fix the problem
I resolved this issue by moving
code to application level in manifest file.
Please consider this if your are a beginner or little confusion about fileprovider configure
Here is a case solution genuine or secure
Environment.getExternalStorageDirectory() returns path like this:
Comments
michaelmika commented Feb 27, 2018 •
file_paths.xml looks like this (note: I also added the path defined by react-native-image-crop-picker ‘s Manifest):
My react-native use of the Share library looks this way:
What am I missing? Have now worked on this for days and really need to get around this problem.
Versions:
react-native-share: 1.0.26
react-native: 0.52.2
react-native-image-crop-picker: 0.19.1
The text was updated successfully, but these errors were encountered:
nu5rim3 commented Mar 16, 2018
# Any solution
ricardochen commented Mar 20, 2018
Same problem here.
ricardochen commented Mar 20, 2018
Mifayo commented Mar 29, 2018 •
same here
svnshikhil commented Apr 4, 2018
tuananhluong commented Apr 15, 2018 •
I resolved as bellow, may be can help someone.
Step1: In the file app/src/main/AndroidManifest.xml,
Step2: Create file provider_paths.xml at app/src/main/res/xml/
Example in my app:
Step3: Update MainApplication.java, implement ShareApplication
Example in my app:
Noted: com.ulo is my applicationId, change to your applicationId (you can check id in app/build.gradle)
Package: react-native / react-native-share / react-native-image-crop-picker
Catlc commented May 16, 2018
Step3 !!! return «com.ulo.provider»; This value is not passed in the past and getFileProviderAuthority Not be invoked why????
tuananhluong commented May 17, 2018
@Catlc ulo is my applicationId, replace by your appid
zynnthen commented Jun 12, 2018 •
try this at your file_paths
yeomann commented Jul 27, 2018
this seems fixed, can we close?
jgcmarins commented Jul 27, 2018
already fixed on 1.1.0.
vforvasile commented Sep 29, 2018
Not fixed, not very fun.
jgcmarins commented Sep 29, 2018
@vforvasile which errors are you experiencing?
raulcostea77 commented Oct 1, 2018
@vforvasile, besides what @tuananhluong posted, I added the following line to my filepaths.xml:
This seems to have fixed my issue
lucaspang commented Oct 26, 2018
I have the same problem, my file is saved at:
file:///data/user/0/com.applicationId/cache/image_manager_disk_cache/a551283a40d90aa951eb098148ed0a6423a78ec29f8df43a7fe2a79a7f85794d.0
and getting this error:
Failed to find configured root that contains /data/data/com.applicationId/cache/image_manager_disk_cache/a551283a40d90aa951eb098148ed0a6423a78ec29f8df43a7fe2a79a7f85794d.0
I have already applied all possible path in provider path and still no luck