MuntashirAkon/AppManager · error · ApkFormatException
Missing {MANIFEST_FILE}
Error message
Missing {MANIFEST_FILE} What it means
getAndroidManifestFromApk scans the APK's central directory records for the AndroidManifest.xml entry (MANIFEST_FILE) and throws ApkFormatException when the entry is absent. An APK without a manifest is not a valid installable package, so manifest extraction cannot proceed.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkUtils.java:331
}
return writableExtDir;
}
public static int getDensityFromName(@Nullable String densityName) {
Integer density = StaticDataset.DENSITY_NAME_TO_DENSITY.get(densityName);
if (density == null) {
throw new IllegalArgumentException("Unknown density " + densityName);
}
return density;
}
@NonNull
private static ByteBuffer getAndroidManifestFromApk(
@NonNull List<CentralDirectoryRecord> cdRecords, @NonNull DataSource lhfSection)
throws IOException, ApkFormatException, ZipFormatException {
CentralDirectoryRecord androidManifestCdRecord = findCdRecord(cdRecords, MANIFEST_FILE);
if (androidManifestCdRecord == null) {
throw new ApkFormatException("Missing " + MANIFEST_FILE);
}
return ByteBuffer.wrap(LocalFileRecord.getUncompressedData(
lhfSection, androidManifestCdRecord, lhfSection.size()));
}
@Nullable
private static CentralDirectoryRecord findCdRecord(
@NonNull List<CentralDirectoryRecord> cdRecords, @NonNull String name) {
for (CentralDirectoryRecord cdRecord : cdRecords) {
if (name.equals(cdRecord.getName())) {
return cdRecord;
}
}
return null;
}
}
View on GitHub (pinned to 0152f468fc)
Solutions
- Verify the input is a real APK: unzip -l file.apk | grep AndroidManifest.xml must list the entry.
- If using .apks/.xapk containers, extract the base APK first and pass that to getManifestFromApk.
- Re-download or re-export the APK; a missing manifest entry usually means a corrupt or non-APK file.
- Catch ApkFormatException and reject the file before attempting installation or further parsing.
Example fix
// before
ByteBuffer manifest = ApkUtils.getManifestFromApk(apkPath);
// after
try {
ByteBuffer manifest = ApkUtils.getManifestFromApk(apkPath);
} catch (ApkFormatException e) {
throw new IOException("Not a valid APK (no AndroidManifest.xml): " + apkPath, e);
} Defensive patterns
Strategy: validation
Validate before calling
try (ZipFile zf = new ZipFile(apkPath)) {
if (zf.getEntry("AndroidManifest.xml") == null)
throw new IOException("Not an APK: AndroidManifest.xml missing");
} Try / catch
try {
ByteBuffer manifest = ApkUtils.getManifestFromApk(apkPath);
} catch (ApkFormatException | ZipFormatException e) {
Log.e(TAG, "Invalid APK: " + e.getMessage(), e);
} Prevention
- Verify the file extension and content: .apks/.xapk containers must be extracted to the base APK first.
- Check file integrity (size/checksum) after download before parsing.
- Run aapt dump badging as a cheap pre-flight validation.
- Reject files whose central directory cannot list AndroidManifest.xml.
When it happens
Trigger: Calling ApkUtils.getManifestFromApk on a file whose ZIP central directory lacks an AndroidManifest.xml record — e.g. the file is not an APK (a plain ZIP, XAPK/APKS container, or split), or the manifest was stripped during repackaging.
Common situations: Pointing the tool at .apks/.xapk archives instead of the base .apk, corrupted downloads where the central directory is truncated, or obfuscated/stripped APKs from modified toolchains.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Failed to read AndroidManifest.xml
- Malformed APK: not a ZIP archive
- "manifest" has duplicate "application" tags.
- "manifest" tag not found.
- "manifest" does not have required attribute "package".
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/1dddfa51ecf18464.
Report an issue: GitHub.