MuntashirAkon/AppManager · error · BackupException

Backup does not contain any APK files.

Error message

Backup does not contain any APK files.

What it means

verifyApkFiles() finds no APK source files in the backup even though BackupFlags.backupApkFiles() is set, so the 'apk' part of the backup cannot be verified or restored. VerifyOp treats an APK-flagged backup with zero source files as invalid.

Solutions

  1. Re-copy the full backup directory including the APK/source files.
  2. Recreate the backup with APK backup enabled so the APKs are captured.
  3. Clear the 'APK files' flag on restore/verify (BackupFlags) if you only need the data, so verifyApkFiles() is skipped.

Example fix

// before: verify() with flags requesting APKs on a data-only backup -> exception
// after: unset the APK flag before verification
if (!mBackupItem.getSourceFiles().isEmpty()) {
    flags.setBackupApkFiles(false); // or restore APKs from a complete backup
}
Defensive patterns

Strategy: validation

Validate before calling

// Check flag/file consistency before verify
if (flags.backupApkFiles() && backupItem.getSourceFiles().length == 0) {
    // either fix flags or restore the APK files
    flags.setBackupApkFiles(false);
}

Try / catch

try {
    verifyOp.verify();
} catch (BackupException e) {
    if (e.getMessage().equals("Backup does not contain any APK files.")) {
        // backup is data-only; disable APK flag or obtain full backup
    }
}

Prevention

When it happens

Trigger: verify() calls verifyApkFiles() when mBackupFlags.backupApkFiles() is true and mBackupItem.getSourceFiles() returns an empty array — no *.apk files present in the backup directory.

Common situations: Backup was made with a data-only configuration but flags still request APK verification; APK files were deleted or lost when moving the backup directory; splitting/merging backup archives incorrectly dropped the APKs; copying only part of the backup folder to the new device.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

        try {
            metadataFile = isV5AndUp ? mBackupItem.getMetadataV5File(false) : mBackupItem.getMetadataV2File();
        } catch (IOException e) {
            throw new BackupException("Could not get metadata file.", e);
        }
        String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, metadataFile);
        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;

View on GitHub (pinned to 0152f468fc)