{"record":{"id":"ce4698ee68868eae","repo":"MuntashirAkon/AppManager","slug":"apk-files-backup-is-requested-but-no-apk-files-have-been-ce4698","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/TBConverter.java","lineNumber":227,"sourceCode":"            throw new BackupException(\"Couldn't decompress \" + mSourceMetadata.apkName, e);\n        }\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        } finally {\n            baseApkFile.requireParent().delete();\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));\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        Path dataFile;\n        try {\n            dataFile = getDataFile(Paths.trimPathExtension(mPropFile.getName()), mSourceMetadata.tarType);","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java#L209-L245","documentation":"backupApkFile() re-packs the staged base.apk into the destination archive with TarUtils.create(), filtering for .apk files. Any Throwable is wrapped as this BackupException. It means the APK re-packaging step failed or produced no matching files, so the requested APK backup cannot be completed.","triggerScenarios":"TarUtils.create(...) throws (archive creation fails, staged base.apk missing/unreadable) or returns an empty list, making toArray(new Path[0]) yield an empty sourceFiles array for an mDestMetadata that flags backupApkFiles().","commonSituations":"The earlier extraction step left no base.apk (silent extraction failure); destination tarType unsupported; staged directory deleted prematurely; .apk name filter regex not matching the staged file name.","solutions":["Verify the staged base.apk exists and is non-empty before calling TarUtils.create(); fix the preceding extraction step if it's missing.","Check that mDestMetadata.info.tarType is a supported archive type and the .apk filter regex matches the staged file.","Check free space and writability of the destination backup path.","Inspect the wrapped Throwable `th` for the concrete TarUtils failure."],"exampleFix":"// before\nPath[] sourceFiles = TarUtils.create(...).toArray(new Path[0]);\n// after\nList<Path> files = TarUtils.create(...);\nif (files.isEmpty()) {\n    throw new IOException(\"No .apk files produced during re-packaging; staged APK missing?\");\n}\nPath[] sourceFiles = files.toArray(new Path[0]);","handlingStrategy":"validation","validationCode":"// Confirm the staged APK exists before re-packaging\nFile staged = new File(stagingDir, \"base.apk\");\nif (!staged.isFile() || staged.length() == 0) {\n    throw new IOException(\"Staged base.apk missing/empty — extraction step failed\");\n}","typeGuard":"fun Path?.isReadableFile(): Boolean = this != null && Files.isRegularFile(this) && Files.size(this) > 0","tryCatchPattern":"try {\n    converter.convert();\n} catch (BackupException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"no APK files have been backed up\")) {\n        inspectWrappedCause(e); // TarUtils.create's Throwable explains packaging failure\n    }\n}","preventionTips":["Verify the staged APK exists and is non-empty before the re-packaging step.","Ensure the destination tarType is supported and the .apk filter regex matches staged filenames.","Check wrapped cause `th` — this message is generic and the real error is inside."],"tags":["tar","archive","apk"],"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-14T16:17:12.679Z"}