title: FileProvider - IllegalArgumentException: Failed to find configured root
body: <p>I'm trying to take a picture with camera, but I'm getting the following error:</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.example.marek.myapplication, PID: 6747
  java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/com.example.marek.myapplication/files/Pictures/JPEG_20170228_175633_470124220.jpg
      at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:711)
      at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:400)
      at com.example.marek.myapplication.MainActivity.dispatchTakePictureIntent(MainActivity.java:56)
      at com.example.marek.myapplication.MainActivity.access$100(MainActivity.java:22)
      at com.example.marek.myapplication.MainActivity$1.onClick(MainActivity.java:35)
  </code></pre>
  
  <p>AndroidManifest.xml:</p>
  
  <pre><code>&lt;provider
          android:name="android.support.v4.content.FileProvider"
          android:authorities="com.example.marek.myapplication.fileprovider"
          android:enabled="true"
          android:grantUriPermissions="true"&gt;
          &lt;meta-data
              android:name="android.support.FILE_PROVIDER_PATHS"
              android:resource="@xml/file_paths" /&gt;
  &lt;/provider&gt;
  </code></pre>
  
  <p>Java:</p>
  
  <pre><code>Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      // Ensure that there's a camera activity to handle the intent
      if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
          // Create the File where the photo should go
          File photoFile = null;
          try {
              photoFile = createImageFile();
          } catch (IOException ex) {
              Toast.makeText(getApplicationContext(), "Error while saving picture.", Toast.LENGTH_LONG).show();
          }
          // Continue only if the File was successfully created
          if (photoFile != null) {
              Uri photoURI = FileProvider.getUriForFile(this,
                      "com.example.marek.myapplication.fileprovider",
                      photoFile);
              takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
              startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
          }
      }
  </code></pre>
  
  <p>file_paths.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths&gt;
      &lt;files-path name="my_images" path="images/"/&gt;
  &lt;/paths&gt;
  </code></pre>
  
  <p>I was searching whole day about this error and trying to understand <code>FileProvider</code>, but I have no idea what this error message tries to tell me. If you want more info/code, write me in the comment.</p>