title: Parse errorr trying to install downloaded .apk file
body: <p>I want to upgrade my app. and i get new version .apk on server. It is work on manually if delete old version app. on device but if I do not delete old version app. does not work again I take same parse error.</p>
  
  <p>I added AndroidManifest file:<br>  <code>&lt;uses-permission android:name="android.permission.INSTALL_PACKAGES"
   tools:ignore="ProtectedPermissions" /&gt;</code></p>
  
  <p>I test another .apk and it is work.</p>
  
  <pre><code>public class VersionUpdateTask extends AsyncTask&lt;String, Float, String&gt; {
  
  @Override
  protected void onPostExecute(String result) {
      mWakeLock.release();
  
      updateManager.updateBar.stop();
  
      else {
  
          try {
  
              String PATH = Environment.getExternalStorageDirectory() + "/download/";
              File file = new File(PATH, updateManager.apkOutPath);
              if (Build.VERSION.SDK_INT &gt;=Build.VERSION_CODES.N) {
                  Uri fileUri = FileProvider.getUriForFile(updateManager.updateContext,updateManager.updateContext.getPackageName() + ".provider", file);
                  Intent intent = new Intent(Intent.ACTION_VIEW, fileUri);
                  intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
                  intent.setDataAndType(fileUri, "application/vnd.android" + ".package-archive");
                  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                  intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                  updateManager.updateContext.startActivity(intent);
  
              } else {
                  Intent intent = new Intent(Intent.ACTION_VIEW);
                  intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
                  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  
  
                  updateManager.updateContext.startActivity(intent);
              }
          }
          catch (Exception e){
              e.printStackTrace();
          }
  
      }
  
  
  
  }
  
  }
  </code></pre>