Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support duplicated namespaces #3233

Merged
merged 1 commit into from
Jul 30, 2023
Merged

fix: support duplicated namespaces #3233

merged 1 commit into from
Jul 30, 2023

Conversation

iBotPeaches
Copy link
Owner

In some applications we find duplicate namespaces. This because we move onward to common XML tools to extract/modify end up crashing.

I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
[Fatal Error] :5:61: Attribute "xmlns:android" was already specified for element "manifest".

These were indeed duplicates so it was not Apktool introducing them.

➜  2664 aapt2 d xmltree 2664.apk --file AndroidManifest.xml | more
N: android=http://schemas.android.com/apk/res/android (line=4294967295)
  N: amazon=http://schemas.amazon.com/apk/res/android (line=4294967295)
    N: android=http://schemas.android.com/apk/res/android (line=4294967295)

So we maintain a mapping of prefix/uri and skip it if we encounter it again. This happens at writing time so we don't have to mess with indexes/stacks.

fixes: #2664

@iBotPeaches iBotPeaches marked this pull request as ready for review July 29, 2023 23:03
@iBotPeaches iBotPeaches merged commit 57ef8a2 into master Jul 30, 2023
31 checks passed
@iBotPeaches iBotPeaches deleted the issue-2664 branch July 30, 2023 09:52
@iBotPeaches iBotPeaches added this to the v2.8.2 milestone Jul 30, 2023
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.

[BUG] Duplicated xmlns:android attribute
1 participant