{"record":{"id":"8a19d62588a0b7e4","repo":"MuntashirAkon/AppManager","slug":"could-not-verify-apk-files-nfile-file-getname-nfound","errorCode":null,"errorMessage":"Could not verify APK files.\\nFile: \" + file.getName() + \"\\nFound: \" + checksum + \"\\nRequired: \" + mChecksum.get(file.getName())","messagePattern":"Could not verify APK files\\.\\\\nFile: \" \\+ file\\.getName\\(\\) \\+ \"\\\\nFound: \" \\+ checksum \\+ \"\\\\nRequired: \" \\+ mChecksum\\.get\\(file\\.getName\\(\\)\\)","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java","lineNumber":149,"sourceCode":"        if (!checksum.equals(mChecksum.get(metadataFile.getName()))) {\n            throw new BackupException(\"Couldn't verify metadata file.\" +\n                    \"\\nFile: \" + metadataFile +\n                    \"\\nFound: \" + checksum +\n                    \"\\nRequired: \" + mChecksum.get(metadataFile.getName()));\n        }\n    }\n\n    private void verifyApkFiles() throws BackupException {\n        Path[] backupSourceFiles = mBackupItem.getSourceFiles();\n        if (backupSourceFiles.length == 0) {\n            // No APK files found\n            throw new BackupException(\"Backup does not contain any APK files.\");\n        }\n        String checksum;\n        for (Path file : backupSourceFiles) {\n            checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file);\n            if (!checksum.equals(mChecksum.get(file.getName()))) {\n                throw new BackupException(\"Could not verify APK files.\" +\n                        \"\\nFile: \" + file.getName() +\n                        \"\\nFound: \" + checksum +\n                        \"\\nRequired: \" + mChecksum.get(file.getName()));\n            }\n        }\n    }\n\n    private void verifyKeyStore() throws BackupException {\n        Path[] keyStoreFiles = mBackupItem.getKeyStoreFiles();\n        if (keyStoreFiles.length == 0) {\n            // Not having KeyStore backups is fine.\n            return;\n        }\n        String checksum;\n        for (Path file : keyStoreFiles) {\n            checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file);\n            if (!checksum.equals(mChecksum.get(file.getName()))) {\n                throw new BackupException(\"Could not verify KeyStore files.\" +","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java#L131-L167","documentation":"One of the APK files in the backup fails its recorded checksum: DigestUtils.getHexDigest over the source file differs from the value stored in the backup's checksum file. The APK content changed after the backup was created, so App Manager aborts verification to prevent restoring a tampered or corrupt APK.","triggerScenarios":"verify() -> verifyApkFiles() loop; for any Path file from mBackupItem.getSourceFiles(), checksum != mChecksum.get(file.getName()) — also triggered when the checksum file has no entry for that APK's file name.","commonSituations":"APK file truncated or corrupted during copy to SD card/cloud; user replaced or repacked an APK inside the backup folder; checksum file paired with the wrong backup version of the APKs; filesystem corruption on external storage.","solutions":["Identify the failing APK from 'File:' in the message, delete it, and re-copy that file from a known-good copy of the backup.","Recreate the backup to regenerate both APKs and checksums.","Verify the checksum file belongs to the same backup (a mismatched checksum file produces false mismatches).","If corruption recurs, check storage media health / avoid FAT-formatted SD cards for backups."],"exampleFix":"// before\n//   Could not verify APK files. File: base.apk Found: aaa... Required: bbb...\n// after: re-copy base.apk from the intact backup, or recompute its entry\n// $ sha256sum base.apk  -> update checksum file entry","handlingStrategy":"validation","validationCode":"// Verify each APK digest before invoking the library\nfor (Path apk : backupItem.getSourceFiles()) {\n    String found = DigestUtils.getHexDigest(backupInfo.checksumAlgo, apk);\n    if (!found.equals(checksums.get(apk.getName()))) {\n        throw new IllegalStateException(\"corrupt APK in backup: \" + apk.getName());\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    verifyOp.verify();\n} catch (BackupException e) {\n    if (e.getMessage().startsWith(\"Could not verify APK files\")) {\n        // re-copy the named APK or recreate the backup\n    }\n}","preventionTips":["Use binary-safe transfers (adb pull/push) for APK files; avoid MMS/cloud text conversions.","Verify backups immediately after creation and after each move.","Never replace or repack APKs inside an existing backup — create a new backup instead.","Keep checksum files in the same folder as the files they describe and copy them together."],"tags":["backup","apk","integrity","checksum"],"backgroundTag":"checksum-mismatch","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}