Failed to find configured root that contains
See original GitHub issueHi. I’m running into this error when trying to make use of your Library. I combining this library with react-native-document-picker. I have in my android/app/src/main/res/xml
file the following code:
<?xml version='1.0' encoding='utf-8'?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="files" path="/" />
<external-files-path name="external_files" path="" />
<external-path name="external" path="." />
<cache-path name="cache" path="/" />
</paths>
Also, in my AndroidManifest.xml
file, I have:
<provider
android:name="com.vinzscam.reactnativefileviewer.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_viewer_provider_paths"
/>
</provider>
Library is linked as directed in the docs. In my code, after getting the response object returned by react-native-document-picker, I am passing the uri as an argument to the open method:
const resFile = await documentPicker(['images'], {maxWidth: 250}) // This is a utility method that abstracts certain implementations, but functionality is same as regular documentPicker
if (resFile) {
FileViewer.open(resFile.uri)
.then(() => {
//do something awesome here
})
.catch(error => {
console.log(error) // This bit prints out the `Failed to find configured root that contains` errors
})
}
React Native version: 0.59.9
React Native File Viewer version: 2.0.2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top Results From Across the Web
IllegalArgumentException: Failed to find configured root ...
Your file is stored under getExternalFilesDir() . That maps to <external-files-path> , not <files-path> . Also, your file path does not contain images/...
Read more >Android: FileProvider IllegalArgumentException Failed to find ...
Android : Android: FileProvider IllegalArgumentException Failed to find configured root that contains /data/data/**/files/Videos/final.mp4 ...
Read more >FileProvider Issue: Failed to find configured root that contains
Failed to find configured root that contains /external_files/test.txt. My react-native use of the Share library looks this way:.
Read more >Android Question Failed to find configured root - B4X
Hello, I'm having trouble with this line of code: Sub CreateFileProviderUri (Dir As String, FileName As String) As Object Dim FileProvider ...
Read more >Android: FileProvider IllegalArgumentException ... - iTecNote
I am trying to use FileProvider to play a video from private path.Facing java.lang.IllegalArgumentException: Failed to find configured root that contains ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you need to remove the
filePath.replace('file://', '')
hey @vinzscam hope you are fine, I’m still facing the same issue, can you or anyone here help me to solve this issue.
My Packages Version: react-native-file-viewer": “^2.1.5” “react”: “17.0.2” “react-native”: “0.66.0”