MuntashirAkon/AppManager · error · BackupException

APK files backup is requested but no APK files have been bac

Error message

APK files backup is requested but no APK files have been backed up.

What it means

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.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java:227

            throw new BackupException("Couldn't decompress " + mSourceMetadata.apkName, e);
        }
        // Get certificate checksums
        try {
            String[] checksums = ConvertUtils.getChecksumsFromApk(baseApkFile, mDestMetadata.info.checksumAlgo);
            for (int i = 0; i < checksums.length; ++i) {
                mChecksum.add(CERT_PREFIX + i, checksums[i]);
            }
        } catch (Exception ignore) {
        }
        // Backup APK file
        String sourceBackupFilePrefix = BackupUtils.getSourceFilePrefix(getExt(mDestMetadata.info.tarType));
        Path[] sourceFiles;
        try {
            sourceFiles = TarUtils.create(mDestMetadata.info.tarType, baseApkFile, mBackupItem.getUnencryptedBackupPath(), sourceBackupFilePrefix,
                            /* language=regexp */new String[]{".*\\.apk"}, null, null, false)
                    .toArray(new Path[0]);
        } catch (Throwable th) {
            throw new BackupException("APK files backup is requested but no APK files have been backed up.", th);
        } finally {
            baseApkFile.requireParent().delete();
        }
        // Overwrite with the new files
        try {
            sourceFiles = mBackupItem.encrypt(sourceFiles);
        } catch (IOException e) {
            throw new BackupException("Failed to encrypt " + Arrays.toString(sourceFiles));
        }
        for (Path file : sourceFiles) {
            mChecksum.add(file.getName(), DigestUtils.getHexDigest(mDestMetadata.info.checksumAlgo, file));
        }
    }

    private void backupData() throws BackupException {
        Path dataFile;
        try {
            dataFile = getDataFile(Paths.trimPathExtension(mPropFile.getName()), mSourceMetadata.tarType);

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Verify the staged base.apk exists and is non-empty before calling TarUtils.create(); fix the preceding extraction step if it's missing.
  2. Check that mDestMetadata.info.tarType is a supported archive type and the .apk filter regex matches the staged file.
  3. Check free space and writability of the destination backup path.
  4. Inspect the wrapped Throwable `th` for the concrete TarUtils failure.

Example fix

// before
Path[] sourceFiles = TarUtils.create(...).toArray(new Path[0]);
// after
List<Path> files = TarUtils.create(...);
if (files.isEmpty()) {
    throw new IOException("No .apk files produced during re-packaging; staged APK missing?");
}
Path[] sourceFiles = files.toArray(new Path[0]);
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the staged APK exists before re-packaging
File staged = new File(stagingDir, "base.apk");
if (!staged.isFile() || staged.length() == 0) {
    throw new IOException("Staged base.apk missing/empty — extraction step failed");
}

Type guard

fun Path?.isReadableFile(): Boolean = this != null && Files.isRegularFile(this) && Files.size(this) > 0

Try / catch

try {
    converter.convert();
} catch (BackupException e) {
    if (e.getMessage() != null && e.getMessage().contains("no APK files have been backed up")) {
        inspectWrappedCause(e); // TarUtils.create's Throwable explains packaging failure
    }
}

Prevention

When it happens

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

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

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/ce4698ee68868eae. Report an issue: GitHub.