缓存目录的Android FileProvider:未能找到包含

缓存目录的Android FileProvider:未能找到包含,android,caching,android-7.0-nougat,android-fileprovider,android-7.1-nougat,Android,Caching,Android 7.0 Nougat,Android Fileprovider,Android 7.1 Nougat,我找到了这么多与FileProvider相关的链接,但我没有找到缓存目录的解决方案 java.lang.IllegalArgumentException:找不到配置的根目录 包含/data/data/pkg name/cache/1487876607264.png 我想将其用于缓存目录,如何在提供程序中给出路径 <paths> <external-path name="external_files" path="." /> </paths> 如果我

我找到了这么多与FileProvider相关的链接,但我没有找到缓存目录的解决方案

java.lang.IllegalArgumentException:找不到配置的根目录 包含
/data/data/pkg name/cache/1487876607264.png

我想将其用于缓存目录,如何在提供程序中给出路径

<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);