{"record":{"id":"59380ed9dfae21b4","repo":"MuntashirAkon/AppManager","slug":"no-manifest-found","errorCode":null,"errorMessage":"No manifest found.","messagePattern":"No manifest found\\.","errorType":"exception","errorClass":"ApkFile.ApkFileException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkUtils.java","lineNumber":227,"sourceCode":"        return byteBuffer;\n    }\n\n    @NonNull\n    public static HashMap<String, String> getManifestAttributes(@NonNull ByteBuffer manifestBytes)\n            throws ApkFile.ApkFileException {\n        try (BlockReader reader = new BlockReader(manifestBytes.array())) {\n            HashMap<String, String> manifestAttrs = new HashMap<>();\n            ResXmlDocument xmlBlock = new ResXmlDocument();\n            try {\n                xmlBlock.readBytes(reader);\n            } catch (IOException e) {\n                throw new ApkFile.ApkFileException(e);\n            }\n            xmlBlock.setPackageBlock(AndroidBinXmlDecoder.getFrameworkPackageBlock());\n            ResXmlElement resManifestElement = xmlBlock.getDocumentElement();\n            // manifest\n            if (!\"manifest\".equals(resManifestElement.getName())) {\n                throw new ApkFile.ApkFileException(\"No manifest found.\");\n            }\n            Iterator<ResXmlAttribute> attrIt = resManifestElement.getAttributes();\n            ResXmlAttribute attr;\n            String attrName;\n            while (attrIt.hasNext()) {\n                attr = attrIt.next();\n                attrName = attr.getName();\n                if (TextUtils.isEmpty(attrName)) {\n                    continue;\n                }\n                manifestAttrs.put(attrName, attr.getValueAsString());\n            }\n            // application\n            ResXmlElement resApplicationElement = null;\n            Iterator<ResXmlElement> resXmlElementIt = resManifestElement.getElements(\"application\");\n            if (resXmlElementIt.hasNext()) {\n                resApplicationElement = resXmlElementIt.next();\n            }","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkUtils.java#L209-L245","documentation":"getManifestAttributes decodes the binary AndroidManifest.xml into an XML block and expects the document element to be <manifest>; if the root element is anything else, it throws ApkFileException 'No manifest found.'","triggerScenarios":"The decoded binary XML's document root element name is not 'manifest' — e.g. the buffer passed to AndroidBinXmlDecoder is not AndroidManifest.xml or is not binary Android XML at all.","commonSituations":"Passing a non-manifest XML resource (e.g. AndroidManifest from the wrong split, or a plain-text XML) into the decoder, framework package block mismatch corrupting resource lookups, or decoding an APK whose manifest entry resolved to a different file.","solutions":["Verify the file/byte buffer you pass is actually AndroidManifest.xml from the APK","Confirm the decoded data is binary Android XML (starts with expected AXML magic) and not plain text","Check that the correct APK/split containing the manifest is used","Ensure AndroidBinXmlDecoder framework package block is compatible with the APK"],"exampleFix":"// before\nxmlBlock.setPackageBlock(AndroidBinXmlDecoder.getFrameworkPackageBlock());\nif (!\"manifest\".equals(resManifestElement.getName())) { ... }\n// after\nResXmlElement root = xmlBlock.getDocumentElement();\nif (!\"manifest\".equals(root.getName())) {\n    throw new ApkFile.ApkFileException(\"Expected AndroidManifest.xml, got root element <\" + root.getName() + \">\");\n}","handlingStrategy":"validation","validationCode":"// ensure the buffer is binary Android XML before decoding\nstatic boolean isBinaryXml(byte[] data) {\n    if (data == null || data.length < 4) return false;\n    // AXML files start with the resource-table type header (0x00080003)\n    return (data[0] == 0x03 && data[1] == 0x00 && data[2] == 0x08 && data[3] == 0x00);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return ApkUtils.getManifestAttributes(apkBuffer);\n} catch (ApkFile.ApkFileException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"No manifest\")) {\n        // wrong entry or non-manifest XML was decoded; re-locate AndroidManifest.xml\n    }\n    throw e;\n}","preventionTips":["Confirm you are decoding the APK's AndroidManifest.xml entry, not another resource","Check the buffer starts with the AXML magic bytes before decoding","Use the base APK (or correct split) that contains the manifest","Keep the framework package block in sync with the decoder version"],"tags":["apk","android-manifest","binary-xml"],"backgroundTag":"unexpected-response-shape","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}