{"record":{"id":"03e1b8f5a449b573","repo":"MuntashirAkon/AppManager","slug":"apk-files-backup-is-requested-but-no-apk-files-have-been","errorCode":null,"errorMessage":"APK files backup is requested but no APK files have been backed up.","messagePattern":"APK files backup is requested but no APK files have been backed up\\.","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java","lineNumber":284,"sourceCode":"        }\n        Path baseApkFile = baseApkFiles[0];\n        // Get certificate checksums\n        try {\n            String[] checksums = ConvertUtils.getChecksumsFromApk(baseApkFile, mDestMetadata.info.checksumAlgo);\n            for (int i = 0; i < checksums.length; ++i) {\n                mChecksum.add(CERT_PREFIX + i, checksums[i]);\n            }\n        } catch (Exception ignore) {\n        }\n        // Backup APK file\n        String sourceBackupFilePrefix = BackupUtils.getSourceFilePrefix(getExt(mDestMetadata.info.tarType));\n        Path[] sourceFiles;\n        try {\n            sourceFiles = TarUtils.create(mDestMetadata.info.tarType, baseApkFile, mBackupItem.getUnencryptedBackupPath(), sourceBackupFilePrefix,\n                            /* language=regexp */ new String[]{\".*\\\\.apk\"}, null, null, false)\n                    .toArray(new Path[0]);\n        } catch (Throwable th) {\n            throw new BackupException(\"APK files backup is requested but no APK files have been backed up.\", th);\n        }\n        // Overwrite with the new files\n        try {\n            sourceFiles = mBackupItem.encrypt(sourceFiles);\n        } catch (IOException e) {\n            throw new BackupException(\"Failed to encrypt \" + Arrays.toString(sourceFiles), e);\n        }\n        for (Path file : sourceFiles) {\n            mChecksum.add(file.getName(), DigestUtils.getHexDigest(mDestMetadata.info.checksumAlgo, file));\n        }\n    }\n\n    private void backupData() throws BackupException {\n        List<Path> dataFiles = new ArrayList<>(2);\n        if (mDestMetadata.info.flags.backupInternalData()) {\n            try {\n                dataFiles.add(mBackupLocation.findFile(CryptoUtils.getAppropriateFilename(mPackageName + \".zip\",\n                        mSourceCryptoMode)));","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java#L266-L302","documentation":"backupApkFile() archives the (decrypted) base APK into the new App Manager backup using TarUtils.create() with a regex filter accepting only *.apk files. If the tar creation throws for any reason (no matching files, I/O error, filter mismatch), it is wrapped into this BackupException: the APK backup was requested (flag set earlier) but no APK entries made it into the backup archive.","triggerScenarios":"In backupApkFile(), TarUtils.create(tarType, baseApkFile, unencryptedBackupPath, sourceBackupFilePrefix, new String[]{\".*\\\\.apk\"}, null, null, false) throws Throwable at OABConverter.java:284 — commonly because the decrypted source contained no files matching .*\\.apk or the tar stream failed.","commonSituations":"The decrypted \"APK\" is actually not a valid APK/zip so no entries match the .apk filter; the destination backup path is unwritable or full; tarType unsupported; baseApkFile path points at a file deleted mid-run.","solutions":["Verify baseApkFile is a valid, readable APK (it should be openable as a zip containing classes.dex).","Check the destination backup path exists and is writable, and that storage isn't full.","Confirm the tarType set in mDestMetadata.info.tarType is supported on this device.","Retry the conversion after freeing space or fixing permissions; inspect the wrapped Throwable (getCause()) for the root I/O error."],"exampleFix":"// before: baseApkFile is a corrupted download that isn't a zip\n// after: validate before converting\n// if (!ApkUtils.isApk(baseApkFile)) throw new IOException(\"not a valid APK\");\n// then run convert(...)","handlingStrategy":"try-catch","validationCode":"// Pre-check destination writability and free space\nif (!Files.isWritable(unencryptedBackupDir)\n        || unencryptedBackupDir.getUsableSpace() < apkSize * 2) {\n    throw new IOException(\"Backup destination not writable or too small\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    converter.convert(...);\n} catch (BackupException e) {\n    if (e.getMessage().contains(\"no APK files have been backed up\")) {\n        Log.e(TAG, \"Tar creation failed; cause:\", e.getCause());\n    }\n}","preventionTips":["Validate the decrypted file is a real APK (zip) before archiving.","Ensure the destination backup path exists, is writable, and has enough free space.","Use a supported tarType in the destination metadata."],"tags":["android","backup","tar","apk","archive"],"backgroundTag":"file-write-failed","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}