问题:

使用FileProvider构造SD卡中文件uri时异常

java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/840E-10F6/音乐/千里之外.mp3
at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:678)
at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:377)

解决方案:

provider_paths.xml 中增加 root-path 标签

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

 

相关文章:

  • 2021-12-29
  • 2021-11-11
  • 2021-05-16
  • 2021-05-07
  • 2021-06-09
  • 2021-08-13
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2021-10-28
  • 2021-12-20
  • 2021-08-01
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案