{"record":{"id":"56ebfb6c123594f3","repo":"MuntashirAkon/AppManager","slug":"componentelement-getname-does-not-have-required-attribute","errorCode":null,"errorMessage":"\"<componentElement.getName()>\" does not have  required attribute \"android:name\".","messagePattern":"\"<componentElement\\.getName\\(\\)>\" does not have  required attribute \"android:name\"\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/apk/parser/ManifestParser.java","lineNumber":114,"sourceCode":"                        case TAG_ACTIVITY:\n                        case TAG_ACTIVITY_ALIAS:\n                        case TAG_SERVICE:\n                        case TAG_RECEIVER:\n                        case TAG_PROVIDER:\n                            componentIfList.add(parseComponentInfo(elem));\n                            break;\n                    }\n                }\n            }\n            return componentIfList;\n        }\n    }\n\n    @NonNull\n    private ManifestComponent parseComponentInfo(@NonNull ResXmlElement componentElement) throws IOException {\n        String componentName = getAttributeValue(componentElement, ATTR_NAME);\n        if (componentName == null) {\n            throw new IOException(\"\\\"\" + componentElement.getName() + \"\\\" does not have  required attribute \\\"android:name\\\".\");\n        }\n        ManifestComponent componentIf = new ManifestComponent(new ComponentName(mPackageName, componentName));\n        // manifest -> application -> component -> intent-filter\n        Iterator<ResXmlElement> resXmlElementIt = componentElement.getElements(TAG_INTENT_FILTER);\n        while (resXmlElementIt.hasNext()) {\n            ResXmlElement elem = resXmlElementIt.next();\n            componentIf.intentFilters.add(parseIntentFilter(elem));\n        }\n        return componentIf;\n    }\n\n    @NonNull\n    private ManifestIntentFilter parseIntentFilter(@NonNull ResXmlElement intentFilterElement) {\n        ManifestIntentFilter intentFilter = new ManifestIntentFilter();\n        String priorityString = getAttributeValue(intentFilterElement, ATTR_PRIORITY);\n        if (priorityString != null) {\n            intentFilter.priority = Integer.parseInt(priorityString);\n        }","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/apk/parser/ManifestParser.java#L96-L132","documentation":"parseComponentInfo requires every component element (activity, service, receiver, provider) to carry the android:name attribute, since it is used to build the ComponentName. When getAttributeValue returns null the parser throws instead of producing a component with a null name.","triggerScenarios":"Calling parseComponents on a manifest where an <activity>/<service>/<receiver>/<provider> element inside <application> lacks android:name; componentElement.getName() is interpolated into the message.","commonSituations":"Hand-edited or badly merged manifests, obfuscation tools stripping attributes, corrupted binary XML, custom component tags missing required attributes.","solutions":["Open the manifest (aapt dump xmltree) and add android:name to the offending component, then rebuild","Remove the incomplete component element from AndroidManifest.xml","Rebuild from source ensuring manifest merger does not drop android:name","Skip/flag such APKs as malformed before analysis"],"exampleFix":"// before\n<activity android:exported=\"true\" android:permission=\"...\" />\n// after\n<activity android:name=\"com.example.Main\" android:exported=\"true\" />","handlingStrategy":"try-catch","validationCode":"// aapt dump xmltree app.apk AndroidManifest.xml\n// confirm every activity/service/receiver/provider node has android:name","typeGuard":"boolean componentHasName(ResXmlElement el) {\n    return getAttributeValue(el, \"name\") != null; // mirrors parser's ATTR_NAME lookup\n}","tryCatchPattern":"try {\n    comps = parser.manifestComponents();\n} catch (IOException e) {\n    if (e.getMessage().contains(\"required attribute \\\"android:name\\\"\")) {\n        Log.w(TAG, \"Skipping malformed component manifest\");\n    }\n}","preventionTips":["Keep android:name on all manifest components","Review manifest merger output in CI","Avoid stripping manifest attributes with obfuscation tools"],"tags":["android","apk-parser","manifest","missing-attribute"],"backgroundTag":"missing-required-argument","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"}