{"record":{"id":"33e5ce85b0765184","repo":"MuntashirAkon/AppManager","slug":"couldn-t-perform-a-re-installation-couldn-t-perform-an","errorCode":null,"errorMessage":"Couldn't perform a re-installation|Couldn't perform an installation: ${status}","messagePattern":"Couldn't perform a re-installation\\|Couldn't perform an installation: (.+?)","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java","lineNumber":394,"sourceCode":"\n                @Override\n                public void onFinishedInstall(int sessionId, String packageName, int result, @Nullable String blockingPackage, @Nullable String statusMessage) {\n                    status.set(statusMessage);\n                }\n            });\n            try {\n                if (!packageInstaller.install(allApks, mPackageName, options)) {\n                    String statusMessage;\n                    if (!isVerified) {\n                        // Previously installed app was uninstalled.\n                        statusMessage = \"Couldn't perform a re-installation\";\n                    } else {\n                        statusMessage = \"Couldn't perform an installation\";\n                    }\n                    if (status.get() != null) {\n                        statusMessage += \": \" + status.get();\n                    } else statusMessage += \".\";\n                    throw new BackupException(statusMessage);\n                }\n            } finally {\n                deleteFiles(allApks);  // Clean up apk files\n            }\n            // Get package info, again\n            try {\n                mPackageInfo = PackageManagerCompat.getPackageInfo(mPackageName, GET_SIGNING_CERTIFICATES\n                        | PackageManagerCompat.MATCH_STATIC_SHARED_AND_SDK_LIBRARIES, mUserId);\n                mUid = Objects.requireNonNull(mPackageInfo.applicationInfo).uid;\n                mIsInstalled = true;\n            } catch (Exception e) {\n                throw new BackupException(\"Apparently the install wasn't complete in the previous section.\", e);\n            }\n        }\n    }\n\n    private void restoreKeyStore() throws BackupException {\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java#L376-L412","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Uninstall the existing app (or accept data-clearing) and retry the restore to avoid signature conflicts.","Read the appended status detail and fix accordingly (free storage for INSUFFICIENT_STORAGE, restore all splits for INVALID).","Ensure all split APKs were extracted (check earlier restore logs for staging/extract errors).","Retry the install; transient session failures (timeout, reboot) often succeed on retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"InstallStatus pre = installer.checkCompatibility(apkPaths, userId); if (!pre.success) throw new IllegalStateException(\"Install will fail: \" + pre.message);","typeGuard":null,"tryCatchPattern":"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","preventionTips":["Uninstall conflicting packages with different signatures before restore","Ensure all split APKs are present and staged","Free storage before installation","Read the appended status detail and handle each code specifically"],"tags":["android","package-installer","installation"],"backgroundTag":"http-error-response","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}