Skip to content Skip to sidebar Skip to footer

No Activity Found To Handle Intent (act=android.intent.action.view) Trying To Install Apk

I'm trying to install an APK that I just downloaded. However, when I utilize the intent to install the APK I get error android.content.ActivityNotFoundException: No Activity found

Solution 1:

The problem had to do with the fact that the name of the apk was not the original. Renaming it to its original name worked.

Solution 2:

use this code:

if (Build.VERSION.SDK_INT >= 29) {
    try {
//      DisplayUtils.getInstance().displayLog(TAG, "download completed trying to open application::::::::" + file.getAbsolutePath());
        DisplayUtils.getInstance().displayLog(TAG, "path::::" + Environment.getExternalStorageDirectory() + "/Documents");
        IntentinstallApplicationIntent=newIntent(Intent.ACTION_VIEW);
        Filefile=newFile(Environment.getExternalStorageDirectory() + "/Documents", "yourfile.apk");
        if (file.exists()) {
            DisplayUtils.getInstance().displayLog(TAG, "is readable:::::::::" + file.canRead());
            file.setReadable(true);
            installApplicationIntent.setDataAndType(FileProvider.getUriForFile(context,
                                            BuildConfig.APPLICATION_ID + ".provider",
                                            file), "application/vnd.android.package-archive");
        } else {
            DisplayUtils.getInstance().displayLog(TAG, "file not found after downloading");
        }
        installApplicationIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        installApplicationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        installApplicationIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        context.startActivity(installApplicationIntent);
        ExitActivity.exitApplicationAnRemoveFromRecent(context);
    } catch (Exception cv) {
    }
}

Post a Comment for "No Activity Found To Handle Intent (act=android.intent.action.view) Trying To Install Apk"