Skip to content

fix: Error decode xml (manifest) when parsing an APK file containing …#2646

Merged
skylot merged 1 commit intoskylot:masterfrom
huqiuser:fix_error_decode_manifest
Sep 28, 2025
Merged

fix: Error decode xml (manifest) when parsing an APK file containing …#2646
skylot merged 1 commit intoskylot:masterfrom
huqiuser:fix_error_decode_manifest

Conversation

@huqiuser
Copy link
Copy Markdown
Contributor

This PR is simple and solves the XML parsing failure issue when the APK path contains .aab files. The problem lies in incorrectly determining whether the file is from an aab file.
Our project converts app.aab to app.aab.apks upon build completion and then installs these APKs. However, I wanted to verify that the APK code was correct and unzipped app.aab.apks to the default app.aab folder, but encountered an XML parsing failure.

stack trace:

Error decode manifest
com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
	at com.google.protobuf.InvalidProtocolBufferException.invalidTag(InvalidProtocolBufferException.java:110)
	at com.google.protobuf.CodedInputStream$ArrayDecoder.readTag(CodedInputStream.java:607)
	at com.android.aapt.Resources$XmlNode$Builder.mergeFrom(Resources.java:44113)
	at com.android.aapt.Resources$XmlNode$1.parsePartialFrom(Resources.java:44594)
	at com.android.aapt.Resources$XmlNode$1.parsePartialFrom(Resources.java:44586)
	at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:135)
	at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:168)
	at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:180)
	at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:185)
	at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:25)
	at com.android.aapt.Resources$XmlNode.parseFrom(Resources.java:43897)
	at jadx.plugins.input.aab.parsers.ResXmlProtoParser.decodeProto(ResXmlProtoParser.java:219)
	at jadx.plugins.input.aab.parsers.ResXmlProtoParser.parse(ResXmlProtoParser.java:45)
	at jadx.plugins.input.aab.factories.ProtoXmlResContainerFactory.create(ProtoXmlResContainerFactory.java:38)

@jpstotz
Copy link
Copy Markdown
Collaborator

jpstotz commented Sep 28, 2025

Thanks for your PR. I see the problem: your file name contains ".aab" but has nothing to to with an aab file.

The interesting part is that before PR 2165 Moved AAB input to separate plugin the .aab detection was already very similar to your code from this PR:

this.isProto = args.getInputFiles().size() > 0 && args.getInputFiles().get(0).getName().toLowerCase().endsWith(".aab");

Not sure why this was changed. @AndreiKud Do you remember why you changed the .aab detection from endsWith to contains in your PR last year?

@AndreiKud
Copy link
Copy Markdown
Contributor

@jpstotz I do not. Probably just a bug 👍

@skylot skylot merged commit fd3d488 into skylot:master Sep 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants