MuntashirAkon/AppManager · error · IOException
"manifest" has duplicate "application" tags.
Error message
"manifest" has duplicate "application" tags.
What it means
ManifestParser throws this while walking the binary AndroidManifest XML: the <manifest> root contains more than one <application> element. A valid manifest must have exactly zero or one <application> tag, so a second occurrence means a malformed/recompiled manifest and parsing cannot continue unambiguously.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/parser/ManifestParser.java:81
xmlBlock.setPackageBlock(AndroidBinXmlDecoder.getFrameworkPackageBlock());
ResXmlElement resManifestElement = xmlBlock.getDocumentElement();
// manifest
if (!TAG_MANIFEST.equals(resManifestElement.getName())) {
throw new IOException("\"manifest\" tag not found.");
}
String packageName = getAttributeValue(resManifestElement, ATTR_MANIFEST_PACKAGE);
if (packageName == null) {
throw new IOException("\"manifest\" does not have required attribute \"package\".");
}
mPackageName = packageName;
// manifest -> application
ResXmlElement resApplicationElement = null;
Iterator<ResXmlElement> resXmlElementIt = resManifestElement.getElements(TAG_APPLICATION);
if (resXmlElementIt.hasNext()) {
resApplicationElement = resXmlElementIt.next();
}
if (resXmlElementIt.hasNext()) {
throw new IOException("\"manifest\" has duplicate \"application\" tags.");
}
if (resApplicationElement == null) {
Log.i(TAG, "package %s does not have \"application\" tag.", mPackageName);
return Collections.emptyList();
}
// manifest -> application -> component
List<ManifestComponent> componentIfList = new ArrayList<>(resApplicationElement.getElementsCount());
String tagName;
resXmlElementIt = resApplicationElement.getElements();
while (resXmlElementIt.hasNext()) {
ResXmlElement elem = resXmlElementIt.next();
tagName = elem.getName();
if (tagName != null) {
switch (tagName) {
case TAG_ACTIVITY:
case TAG_ACTIVITY_ALIAS:
case TAG_SERVICE:
case TAG_RECEIVER:View on GitHub (pinned to 0152f468fc)
Solutions
- Inspect the binary manifest with aapt dump xmltree and remove/merge the duplicate <application> element, then rebuild the APK
- Use apktool to decode, fix AndroidManifest.xml to a single <application>, and rebuild/sign
- Obtain a clean copy of the APK from a trusted source
- If you control the build, check manifest merger output for duplicated application nodes
Example fix
// before: parsing unverified APK directly
List<ManifestComponent> comps = new ManifestParser(apk).manifestComponents();
// after
try {
List<ManifestComponent> comps = new ManifestParser(apk).manifestComponents();
} catch (IOException e) {
Log.w(TAG, "Malformed manifest, skipping APK: " + e.getMessage());
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check with aapt/apktool before parsing: // aapt dump xmltree app.apk AndroidManifest.xml | grep -c '<application>' // if count > 1, treat APK as malformed.
Type guard
boolean hasDuplicateApplication(byte[] manifestXml) {
// decode binary XML and count TAG_APPLICATION elements under root
return countElements(manifestXml, "application") > 1;
} Try / catch
try {
List<ManifestComponent> comps = parser.manifestComponents();
} catch (IOException e) {
if (e.getMessage().contains("duplicate \"application\" tags")) {
// mark APK as malformed and skip
}
} Prevention
- Never hand-edit binary manifests; recompile from source
- Validate APKs with apksmith/apktool before batch processing
- Treat aapt warnings about duplicated elements as build errors
When it happens
Trigger: Calling parseComponents (via manifestComponents) on an APK whose binary manifest contains two <application> elements under <manifest>; the iterator over TAG_APPLICATION elements returns a second element.
Common situations: Corrupt or hand-patched APKs, bad recompiles with apktool, maliciously modified manifests, or overlays/merges that duplicated the application tag.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- "<componentElement.getName()>" does not have required attri
- "manifest" has duplicate "application" tags.
- Unknown density {densityName}
- Package name is missing.
- No splits selected.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/503559bf488cf15d.
Report an issue: GitHub.