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

[BUG]Using aapt2 to export packages, extra spaces appear in the meta-data value in AndroidManifest #3567

Closed
yangbo637829 opened this issue Apr 8, 2024 · 1 comment

Comments

@yangbo637829
Copy link

Information

  1. Apktool Version (apktool -version) -2.9.3
  2. Operating System (Mac, Linux, Windows) - mac
  3. APK From? (Playstore, ROM, Other) - playstore
  4. Java Version (java --version) - java11

Bug

When the meta-data in AndroidManifest contains a numeric string, there will be an extra space in front of the value of this field in the new package built.

My fix suggestion

The new version of apktool uses aapt2 for packaging by default, resulting in spaces added when parsing the AndroidManifest that cannot be eliminated. Turn off aapt2 and use aapt1 to create new packages without this problem.

When parsing AndroidManifest, you can decide whether to add spaces in front of numeric strings according to the version of aapt.

code: brut.androlib.res.data.value.ResStringValue#checkIfStringIsNumeric

The code here needs to be modified to solve the problem of test cases failing to pass:
brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/AndroidManifest.xml
image

@iBotPeaches
Copy link
Owner

This is a known issue still. We don't have the knowledge of whether aapt2/aapt1 is in play during the checkIfStringIsNumeric check to properly avoid this.

#2634

I'll close for existing issue.

@iBotPeaches iBotPeaches closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
@yangbo637829 yangbo637829 changed the title [BUG] [BUG]Using aapt2 to export packages, extra spaces appear in the meta-data value in AndroidManifest Apr 8, 2024
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

No branches or pull requests

2 participants