MuntashirAkon/AppManager · error · BackupException

Could not verify APK files.\nFile: " + file.getName() + "\nF

Error message

Could not verify APK files.\nFile: " + file.getName() + "\nFound: " + checksum + "\nRequired: " + mChecksum.get(file.getName())

What it means

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.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java:149

        if (!checksum.equals(mChecksum.get(metadataFile.getName()))) {
            throw new BackupException("Couldn't verify metadata file." +
                    "\nFile: " + metadataFile +
                    "\nFound: " + checksum +
                    "\nRequired: " + mChecksum.get(metadataFile.getName()));
        }
    }

    private void verifyApkFiles() throws BackupException {
        Path[] backupSourceFiles = mBackupItem.getSourceFiles();
        if (backupSourceFiles.length == 0) {
            // No APK files found
            throw new BackupException("Backup does not contain any APK files.");
        }
        String checksum;
        for (Path file : backupSourceFiles) {
            checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file);
            if (!checksum.equals(mChecksum.get(file.getName()))) {
                throw new BackupException("Could not verify APK files." +
                        "\nFile: " + file.getName() +
                        "\nFound: " + checksum +
                        "\nRequired: " + mChecksum.get(file.getName()));
            }
        }
    }

    private void verifyKeyStore() throws BackupException {
        Path[] keyStoreFiles = mBackupItem.getKeyStoreFiles();
        if (keyStoreFiles.length == 0) {
            // Not having KeyStore backups is fine.
            return;
        }
        String checksum;
        for (Path file : keyStoreFiles) {
            checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file);
            if (!checksum.equals(mChecksum.get(file.getName()))) {
                throw new BackupException("Could not verify KeyStore files." +

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Identify the failing APK from 'File:' in the message, delete it, and re-copy that file from a known-good copy of the backup.
  2. Recreate the backup to regenerate both APKs and checksums.
  3. Verify the checksum file belongs to the same backup (a mismatched checksum file produces false mismatches).
  4. If corruption recurs, check storage media health / avoid FAT-formatted SD cards for backups.

Example fix

// before
//   Could not verify APK files. File: base.apk Found: aaa... Required: bbb...
// after: re-copy base.apk from the intact backup, or recompute its entry
// $ sha256sum base.apk  -> update checksum file entry
Defensive patterns

Strategy: validation

Validate before calling

// Verify each APK digest before invoking the library
for (Path apk : backupItem.getSourceFiles()) {
    String found = DigestUtils.getHexDigest(backupInfo.checksumAlgo, apk);
    if (!found.equals(checksums.get(apk.getName()))) {
        throw new IllegalStateException("corrupt APK in backup: " + apk.getName());
    }
}

Try / catch

try {
    verifyOp.verify();
} catch (BackupException e) {
    if (e.getMessage().startsWith("Could not verify APK files")) {
        // re-copy the named APK or recreate the backup
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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