title: FileProvider : Install apk programatically - Failed to find configured root that contains
body: <p>I am using FileProvider  to install apk from my app. Followed many stackoverflow questions but still facing this issue</p>
  
  <pre><code> java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/com.tssi.myapptour/files/download/myapp_newSigned.apk
  </code></pre>
  
  <p>My provider in manifest</p>
  
  <pre><code>&lt;provider
              android:name="androidx.core.content.FileProvider"
              android:authorities="com.tssi.myapptour.provider"
              android:exported="false"
              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>my file_paths.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;files-path name="download" path="download/" /&gt;
  
     &lt;!-- &lt;external-path name="download" path="Android/data/com.tssi.myapptour/files/download/" /&gt;--&gt;
  
  &lt;/paths&gt;
  </code></pre>
  
  <p>And my code for calling apk</p>
  
  <pre><code>String strApkToInstall = "myapp_newSigned.apk";
  File fileApkToInstall = new File(getExternalFilesDir("download"), strApkToInstall);
  
  Intent intent = new Intent(Intent.ACTION_VIEW);
  Uri fileUri = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider",
          fileApkToInstall);
  intent.setDataAndType(fileUri, "application/vnd.android.package-archive");
  intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  startActivity(intent);
  </code></pre>