question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

actionViewIntent error "Failed to find configured root that contains.."

See original GitHub issue

Versions: react-native-cli: 2.0.1 react-native: 0.55.1 rn-fetch-blob: 0.10.13,

Hey! I’m having some problems trying to use the RNFetchBlob.android.actionViewIntent function. When I call it, it throws me this error:

Error: Failed to find configured root that contains /data/data/com.irpfvisaoapp/files/declaration-files/6becc170-b03a-11e8-a70e-876c3834b6e5_2013_DEC.pdf
    at createErrorFromErrorData (NativeModules.js:121)
    at NativeModules.js:78
    at MessageQueue.__invokeCallback (MessageQueue.js:398)
    at MessageQueue.js:137
    at MessageQueue.__guardSafe (MessageQueue.js:314)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:136)
    at debuggerWorker.js: 

I’m invoking it like this: await RNFetchBlob.android.actionViewIntent(path, "application/pdf")

I’m checking if the file exists before running it using RNFetchBlob.fs.exists(path) and it returns true as the file really exists. I’ve also tried to put file:// in the beginning of the path, but it didn’t work either.

const exists = await RNFetchBlob.fs.exists(path)
console.log(path, exists) // "/data/user/0/com.irpfvisaoapp/files/declaration-files/6becc170-b03a-11e8-a70e-876c3834b6e5_2013_DEC.pdf" true

I’ve noticed that the “data” is duplicated in the path inside the error message, but if I try to remove it from the path, the error still occurs.

Any suggestions?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

32reactions
demarchisdcommented, Oct 3, 2018

So, after some research I’ve found that it’s required to create a provider for it to work.

In the case of rn-fetch-blob, it looks for a provider named provider_paths instead of file_paths.

So, what I did was to create a xml file android/app/src/main/res/xml/provider_paths.xml with the following content:

<paths xmlns:android="http://schemas.android.com/apk/res/android">              
   <root-path name="root" path="." />                                            
</paths>     

Hope this can help people that may have the same problem. C/C @antofa

2reactions
antofacommented, Sep 18, 2018

I have this problem too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IllegalArgumentException: Failed to find configured root - ...
I'm trying to take a picture with camera, but I'm getting the following error:
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 >
Android : FileProvider - Failed to find configured root - YouTube
Android : FileProvider - IllegalArgumentException: Failed to find configured root [ Beautify Your Computer ...
Read more >
Android Question Failed to find configured root
The logged error is: "Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains ...
Read more >
Intent | Android Developers
Create an intent to launch the main (root) activity of a task. ... Callers must include CATEGORY_OPENABLE in the Intent to obtain URIs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found