Android FileProvider for CACHE DIR : Failed to find configured root that contains : <p>I found so many links which is related to FileProvider, but I didn't found solution for <strong>cache directory</strong> </p>

<blockquote>
  <p>java.lang.IllegalArgumentException: Failed to find configured root
  that contains <code>/data/data/pkg name/cache/1487876607264.png</code></p>
</blockquote>

<p>I want to use it for <strong>CACHE DIRECTORY</strong>, How can I give path in <strong>provider</strong>.</p>

<pre><code>&lt;paths&gt;
    &lt;external-path name="external_files" path="."  /&gt;
&lt;/paths&gt;
</code></pre>

<p>I used it as :</p>

<pre><code>File file = new File(context.getCacheDir(), System.currentTimeMillis() + ".png");

Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file);
</code></pre>

<p>Its working fine if I give application folder path, but not working with <strong>Cache Directory.</strong></p>

<p>Any Help?</p>
