MuntashirAkon/AppManager · error · BackupException
Could not get base.apk file.
Error message
Could not get base.apk file.
What it means
In backupApkFile(), the converter tries to locate the actual APK file in the backup location using findFile() with the crypto-appropriate name derived from the source metadata's apkName. findFile() throws FileNotFoundException when the file does not exist, which is wrapped into this BackupException. It means the APK that the earlier metadata phase claimed to exist could not actually be found when the backup step ran.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java:255
metadataV2.dataDirs = ConvertUtils.getDataDirs(mPackageName, mUserId, metadataV2.flags
.backupInternalData(), metadataV2.flags.backupExternalData(), false);
metadataV2.tarType = Prefs.BackupRestore.getCompressionMethod();
metadataV2.keyStore = false;
metadataV2.installer = Prefs.Installer.getInstallerPackageName();
metadataV2.version = 2; // Old version is used so that we know that it needs permission fixes
return metadataV2;
} catch (JSONException | IOException | CryptoException e) {
return ExUtils.rethrowAsBackupException("Could not parse JSON file.", e);
}
}
private void backupApkFile() throws BackupException {
Path[] baseApkFiles;
try {
baseApkFiles = new Path[]{mBackupLocation.findFile(CryptoUtils.getAppropriateFilename(
mSourceMetadata.apkName, mSourceCryptoMode))};
} catch (FileNotFoundException e) {
throw new BackupException("Could not get base.apk file.", e);
}
// Decrypt APK file if needed
try {
baseApkFiles = ConvertUtils.decryptSourceFiles(baseApkFiles, mSourceCrypto, mSourceCryptoMode, mBackupItem);
} catch (IOException e) {
throw new BackupException("Failed to decrypt " + Arrays.toString(baseApkFiles), e);
}
// baseApkFiles should be a singleton array
if (baseApkFiles.length != 1) {
throw new BackupException("Incorrect number of APK files: " + baseApkFiles.length);
}
Path baseApkFile = baseApkFiles[0];
// 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]);
}View on GitHub (pinned to 0152f468fc)
Solutions
- Confirm the APK file matching the source metadata's apkName exists in the backup location before running the conversion.
- Restore/re-copy the APK from the original OAndBackup backup if it was deleted.
- Check mSourceCryptoMode: an encrypted source stores files under crypto-transformed names; a wrong mode yields a wrong lookup name.
- Ensure apkName in the log matches the real file name (e.g. base.apk vs. an app-specific name).
Example fix
// before // backup/ contains "base.apk" but log says "apkName": "app-release.apk" // after: align names // "apkName": "base.apk" (or rename the file to app-release.apk)
Defensive patterns
Strategy: try-catch
Validate before calling
String expected = CryptoUtils.getAppropriateFilename(sourceMetadata.apkName, sourceCryptoMode);
if (!backupLocation.hasFile(expected)) {
Log.w(TAG, "APK missing before backup step: " + expected);
} Try / catch
try {
converter.convert(...);
} catch (BackupException e) {
if (e.getMessage().startsWith("Could not get base.apk")) {
Log.e(TAG, "APK vanished or misnamed: " + e.getCause(), e);
}
} Prevention
- Do not modify the backup directory while a conversion is running.
- Ensure apkName in metadata matches the actual on-disk file name.
- Verify source crypto mode so findFile() looks up the right (possibly encrypted) name.
When it happens
Trigger: backupApkFile() (called from convert()) executes mBackupLocation.findFile(CryptoUtils.getAppropriateFilename(mSourceMetadata.apkName, mSourceCryptoMode)) and the file is missing, throwing FileNotFoundException at OABConverter.java:255.
Common situations: Race/deletion: the APK was removed from the backup dir between the metadata scan and the backup step; apkName in the source metadata differs from the on-disk filename (renamed, split APK names); wrong source crypto mode producing the wrong expected filename.
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
- not found at
- Destination doesn't contain any APK files.
- Could not get backup files.
- APK files backup is requested but no source directory has be
- Failed to encrypt
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/8d8f7c54dd722ed8.
Report an issue: GitHub.