[BUG]Using aapt2 to export packages, extra spaces appear in the meta-data value in AndroidManifest
yangbo637829 opened this issue · comments
Information
- Apktool Version (
apktool -version
) -2.9.3 - Operating System (Mac, Linux, Windows) - mac
- APK From? (Playstore, ROM, Other) - playstore
- 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
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.
I'll close for existing issue.