{"record":{"id":"0cd3673680053f17","repo":"MuntashirAkon/AppManager","slug":"backup-does-not-contain-any-apk-files","errorCode":null,"errorMessage":"Backup does not contain any APK files.","messagePattern":"Backup does not contain any APK files\\.","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java","lineNumber":143,"sourceCode":"        try {\n            metadataFile = isV5AndUp ? mBackupItem.getMetadataV5File(false) : mBackupItem.getMetadataV2File();\n        } catch (IOException e) {\n            throw new BackupException(\"Could not get metadata file.\", e);\n        }\n        String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, metadataFile);\n        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;","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java#L125-L161","documentation":"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.","triggerScenarios":"verify() calls verifyApkFiles() when mBackupFlags.backupApkFiles() is true and mBackupItem.getSourceFiles() returns an empty array — no *.apk files present in the backup directory.","commonSituations":"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.","solutions":["Re-copy the full backup directory including the APK/source files.","Recreate the backup with APK backup enabled so the APKs are captured.","Clear the 'APK files' flag on restore/verify (BackupFlags) if you only need the data, so verifyApkFiles() is skipped."],"exampleFix":"// before: verify() with flags requesting APKs on a data-only backup -> exception\n// after: unset the APK flag before verification\nif (!mBackupItem.getSourceFiles().isEmpty()) {\n    flags.setBackupApkFiles(false); // or restore APKs from a complete backup\n}","handlingStrategy":"validation","validationCode":"// Check flag/file consistency before verify\nif (flags.backupApkFiles() && backupItem.getSourceFiles().length == 0) {\n    // either fix flags or restore the APK files\n    flags.setBackupApkFiles(false);\n}","typeGuard":null,"tryCatchPattern":"try {\n    verifyOp.verify();\n} catch (BackupException e) {\n    if (e.getMessage().equals(\"Backup does not contain any APK files.\")) {\n        // backup is data-only; disable APK flag or obtain full backup\n    }\n}","preventionTips":["Match flags to backup content: data-only backups should not carry the APK flag.","Copy whole backup directories; don't cherry-pick files when moving between devices.","After a backup, list the directory and confirm APK files are present if the APK flag was used.","Compare flags stored in backup-info.json against what you expect before verifying."],"tags":["backup","apk","missing-files"],"backgroundTag":"file-not-found","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"}