MuntashirAkon/AppManager · error · BackupException

Couldn't perform a re-installation|Couldn't perform an…

Error message

Couldn't perform a re-installation|Couldn't perform an installation: ${status}

What it means

restoreApkFiles hands the staged APKs to the installer (via PackageInstaller). This error means the install session reported a failure; the message is either "Couldn't perform a re-installation" (package already present) or "Couldn't perform an installation: <status>" with the installer's status detail. It is the terminal failure of the APK restore step.

Solutions

  1. Uninstall the existing app (or accept data-clearing) and retry the restore to avoid signature conflicts.
  2. Read the appended status detail and fix accordingly (free storage for INSUFFICIENT_STORAGE, restore all splits for INVALID).
  3. Ensure all split APKs were extracted (check earlier restore logs for staging/extract errors).
  4. Retry the install; transient session failures (timeout, reboot) often succeed on retry.
Defensive patterns

Strategy: try-catch

Validate before calling

InstallStatus pre = installer.checkCompatibility(apkPaths, userId); if (!pre.success) throw new IllegalStateException("Install will fail: " + pre.message);

Try / catch

if (status.get() != null) throw new BackupException("Couldn't perform an installation: " + status.get()); // branch on status code: INSUFFICIENT_STORAGE -> free space; SIGNATUREMismatch -> uninstall first

Prevention

When it happens

Trigger: The PackageInstaller commit returns a non-success status: signature mismatch with an installed package, INSUFFICIENT_STORAGE, INCOMPATIBLE/INVALID apk, session abandoned, or user/timeout rejection.

Common situations: Reinstalling over an app signed with a different key; split-APK set incomplete so the session is invalid; storage exhaustion; device dropped the install session (reboot/timeout); downgrade attempts without -d.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/33e5ce85b0765184. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:394

                @Override
                public void onFinishedInstall(int sessionId, String packageName, int result, @Nullable String blockingPackage, @Nullable String statusMessage) {
                    status.set(statusMessage);
                }
            });
            try {
                if (!packageInstaller.install(allApks, mPackageName, options)) {
                    String statusMessage;
                    if (!isVerified) {
                        // Previously installed app was uninstalled.
                        statusMessage = "Couldn't perform a re-installation";
                    } else {
                        statusMessage = "Couldn't perform an installation";
                    }
                    if (status.get() != null) {
                        statusMessage += ": " + status.get();
                    } else statusMessage += ".";
                    throw new BackupException(statusMessage);
                }
            } finally {
                deleteFiles(allApks);  // Clean up apk files
            }
            // Get package info, again
            try {
                mPackageInfo = PackageManagerCompat.getPackageInfo(mPackageName, GET_SIGNING_CERTIFICATES
                        | PackageManagerCompat.MATCH_STATIC_SHARED_AND_SDK_LIBRARIES, mUserId);
                mUid = Objects.requireNonNull(mPackageInfo.applicationInfo).uid;
                mIsInstalled = true;
            } catch (Exception e) {
                throw new BackupException("Apparently the install wasn't complete in the previous section.", e);
            }
        }
    }

    private void restoreKeyStore() throws BackupException {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {

View on GitHub (pinned to 0152f468fc)