MuntashirAkon/AppManager · error · IOException
"manifest" does not have required attribute "package".
Error message
"manifest" does not have required attribute "package".
What it means
ManifestParser.parseComponents throws IOException("\"manifest\" does not have required attribute \"package\".") when the root <manifest> element exists but lacks the mandatory android-namespace-less "package" attribute that names the app. The package name is required to populate mPackageName, so without it parsing cannot continue.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/parser/ManifestParser.java:71
}
public ManifestParser(@NonNull ByteBuffer manifestBytes) {
mManifestBytes = manifestBytes;
}
public List<ManifestComponent> parseComponents() throws IOException {
try (BlockReader reader = new BlockReader(mManifestBytes.array())) {
ResXmlDocument xmlBlock = new ResXmlDocument();
xmlBlock.readBytes(reader);
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;View on GitHub (pinned to 0152f468fc)
Solutions
- Rebuild the APK with a standard build (Gradle/aapt2) so <manifest package="..."> is emitted.
- If repackaging, preserve the package attribute on the manifest root before recompiling AXML.
- Verify with aapt dump badging that the APK reports a package name before parsing.
- Fall back to reading packageName from PackageInfo/PackageParser if the attribute is missing.
Example fix
// before
String packageName = getAttributeValue(resManifestElement, ATTR_MANIFEST_PACKAGE);
if (packageName == null) throw new IOException("\"manifest\" does not have required attribute \"package\".");
// after
String packageName = getAttributeValue(resManifestElement, ATTR_MANIFEST_PACKAGE);
if (packageName == null) {
packageName = fallbackPackageNameFromArchive(); // e.g. from APK path or PackageParser
if (packageName == null) {
throw new IOException("\"manifest\" does not have required attribute \"package\".");
}
}
mPackageName = packageName; Defensive patterns
Strategy: try-catch
Validate before calling
// After decoding, confirm the manifest declares a package before full parse // (higher-level check: the APK must report a package via aapt/badging) // adb shell aapt dump badging app.apk | grep '^package:'
Try / catch
try {
manifestParser.parse();
} catch (IOException e) {
if (e.getMessage().contains("required attribute \"package\"")) {
report("Manifest lacks package attribute; APK likely repackaged or malformed");
} else throw e;
} Prevention
- Use APKs built by standard Gradle/aapt2 toolchains; avoid hand-crafted AXML.
- If repackaging, always preserve the package attribute on the manifest root.
- Sanity-check with `aapt dump badging` (package: name=...) before parsing.
- Have a fallback package-name source (filename convention or PackageParser) for damaged manifests.
When it happens
Trigger: parseComponents reads the root manifest element successfully, but getAttributeValue(element, ATTR_MANIFEST_PACKAGE) returns null — i.e. the AXML root has no package attribute, typically because the manifest was built/repacked without it (e.g. with aapt2 'generate without package', heavy resource obfuscation, or hand-crafted AXML).
Common situations: APKs repackaged by tools that strip the package attribute, manifests synthesized programmatically and compiled without package, or merged-manifest builds gone wrong. Rarely seen with APKs produced by normal Gradle/aapt builds.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- "manifest" tag not found.
- "manifest" has duplicate "application" tags.
- "<componentElement.getName()>" does not have required attri
- Failed to read AndroidManifest.xml
- Missing {MANIFEST_FILE}
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/66f0eb835cb19599.
Report an issue: GitHub.