title: Android: IllegalArgumentException: Failed to find configured root that contains /data/data/
body: <p>Just getting into the Glide image loading library for Android. 
  Working with code from here: <a href="https://github.com/bumptech/glide/issues/459" rel="nofollow noreferrer">https://github.com/bumptech/glide/issues/459</a></p>
  
  <p>Full project here:
  <a href="https://github.com/mhurwicz/glide02" rel="nofollow noreferrer">https://github.com/mhurwicz/glide02</a></p>
  
  <p>I'm getting the following exception when I run the app in the emulator in Android Studio:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.example.glide02/cache/image_manager_disk_cache/5a992029460eed14244e8b970d969d45518b2f7ac10f71eb26bd0aaf7c3bcf06.0
  </code></pre>
  
  <p>The rest of the messages are:</p>
  
  <pre><code>at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:711)
                    at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:400)
                    at com.example.glide02.ShareTask.onPostExecute(ShareTask.java:37)
                    at com.example.glide02.ShareTask.onPostExecute(ShareTask.java:15)
                    at android.os.AsyncTask.finish(AsyncTask.java:651)
                    at android.os.AsyncTask.-wrap1(AsyncTask.java)
                    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
                    at android.os.Handler.dispatchMessage(Handler.java:102)
                    at android.os.Looper.loop(Looper.java:148)
                    at android.app.ActivityThread.main(ActivityThread.java:5417)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>
  
  <p>The error occurs on FileProvider.getUriForFile()</p>
  
  <pre><code>@Override protected void onPostExecute(File result) {
      if (result == null) { return; }
      Uri uri = FileProvider.getUriForFile(context, context.getPackageName(), result);
      share(uri); // startActivity probably needs UI thread
  }
  </code></pre>
  
  <p>I've looked at several other questions relating to this error, but can't see how they relate to my case, perhaps due to my lack of familiarity with this whole area.</p>
  
  <p>Any help will be greatly appreciated.</p>
  
  <p>This is the full code for the class in which the above method occurs:</p>
  
  <pre><code>class ShareTask extends AsyncTask&lt;String, Void, File&gt; {
  private final Context context;
  
  public ShareTask(Context context) {
      this.context = context;
  }
  @Override protected File doInBackground(String... params) {
      String url = params[0]; // should be easy to extend to share multiple images at once
      try {
          return Glide
                  .with(context)
                  .load(url)
                  .downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
                  .get() // needs to be called on background thread
                  ;
      } catch (Exception ex) {
          Log.w("SHARE", "Sharing " + url + " failed", ex);
          return null;
      }
  }
  @Override protected void onPostExecute(File result) {
      if (result == null) { return; }
      Uri uri = FileProvider.getUriForFile(context, context.getPackageName(), result);
      share(uri); // startActivity probably needs UI thread
  }
  
  private void share(Uri result) {
      Intent intent = new Intent(Intent.ACTION_SEND);
      intent.setType("image/jpeg");
      intent.putExtra(Intent.EXTRA_SUBJECT, "Shared image");
      intent.putExtra(Intent.EXTRA_TEXT, "Look what I found!");
      intent.putExtra(Intent.EXTRA_STREAM, result);
      context.startActivity(Intent.createChooser(intent, "Share image"));
  }
  </code></pre>
  
  <p>}</p>