diff --git a/src/main/java/com/reandroid/apkeditor/common/AndroidManifestHelper.java b/src/main/java/com/reandroid/apkeditor/common/AndroidManifestHelper.java index 833ae522..919917e1 100644 --- a/src/main/java/com/reandroid/apkeditor/common/AndroidManifestHelper.java +++ b/src/main/java/com/reandroid/apkeditor/common/AndroidManifestHelper.java @@ -76,6 +76,21 @@ public static void removeAttributeFromManifestByName(AndroidManifestBlock androi logger.logMessage("Removed-attribute : " + resourceName); } } + public static void removeAttributeFromManifestById(AndroidManifestBlock androidManifestBlock, + int resourceId, APKLogger logger){ + ResXmlElement manifestElement = androidManifestBlock.getManifestElement(); + if(manifestElement == null){ + if(logger != null){ + logger.logMessage("WARN: AndroidManifest don't have "); + } + return; + } + int removed = manifestElement.removeAttributesWithId(resourceId); + if (removed > 0 && logger != null) { + logger.logMessage("Removed-attribute : " + HexUtil.toHex8("@0x", resourceId)); + } + } + public static void removeAttributeFromManifestAndApplication(AndroidManifestBlock androidManifestBlock, int resourceId, APKLogger logger, String nameForLogging){ diff --git a/src/main/java/com/reandroid/apkeditor/merge/Merger.java b/src/main/java/com/reandroid/apkeditor/merge/Merger.java index 2a78b0ab..a7aa9d27 100644 --- a/src/main/java/com/reandroid/apkeditor/merge/Merger.java +++ b/src/main/java/com/reandroid/apkeditor/merge/Merger.java @@ -138,6 +138,18 @@ private void sanitizeManifest(ApkModule apkModule) { } AndroidManifestBlock manifest = apkModule.getAndroidManifest(); logMessage("Sanitizing manifest ..."); + + // FIXME: declare ID_requiredSplitTypes & ID_splitTypes at AndroidManifest + int ID_requiredSplitTypes = 0x0101064e; + int ID_splitTypes = 0x0101064f; + + AndroidManifestHelper.removeAttributeFromManifestById(manifest, + ID_requiredSplitTypes, this); + AndroidManifestHelper.removeAttributeFromManifestById(manifest, + ID_splitTypes, this); + AndroidManifestHelper.removeAttributeFromManifestByName(manifest, + AndroidManifest.NAME_splitTypes, this); + AndroidManifestHelper.removeAttributeFromManifestByName(manifest, AndroidManifest.NAME_requiredSplitTypes, this); AndroidManifestHelper.removeAttributeFromManifestByName(manifest,