Search code examples
androidandroid-fileprovider

How to get URI from file with FileProvider


How can I get URI from a file with a dynamic folder in the path?

java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/AppName/155522864927/media/1555228649276.mp4

It works fine only if I set hardcoded path

<external-path name="/" path="AppName/155522864927/media/" />


Solution

  • The path cannot be random. You need to configure the path that you expose. For more info please have a look here.