【发布时间】:2017-07-14 10:27:53
【问题描述】:
我找到了很多与FileProvider相关的链接,但我没有找到缓存目录的解决方案
java.lang.IllegalArgumentException:找不到配置的根目录 包含
/data/data/pkg name/cache/1487876607264.png
我想将它用于 CACHE DIRECTORY,如何在 provider 中提供路径。
<paths>
<external-path name="external_files" path="." />
</paths>
我把它用作:
File file = new File(context.getCacheDir(), System.currentTimeMillis() + ".png");
Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file);
如果我提供应用程序文件夹路径,它可以正常工作,但不能使用 缓存目录。
有什么帮助吗?
【问题讨论】:
标签: android caching android-7.0-nougat android-fileprovider android-7.1-nougat