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] Error parsing styled strings #3588

Open
JoshMiers-FS opened this issue May 2, 2024 · 1 comment
Open

[BUG] Error parsing styled strings #3588

JoshMiers-FS opened this issue May 2, 2024 · 1 comment

Comments

@JoshMiers-FS
Copy link
Contributor

Information

  1. Apktool Version (apktool -version) - 2.9.3
  2. Operating System (Mac, Linux, Windows) - Mac
  3. APK From? (Playstore, ROM, Other) - Other
  4. Java Version (java --version) - Openjdk 17.0.9 2023-10-17 LTS

Stacktrace/Logcat

I: Using Apktool 2.9.3 on app-debug.apk
I: Loading resource table...
Exception in thread "main" java.lang.IllegalArgumentException: Chunk [color:#00a652] is not a valid entry
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:218)
	at com.google.common.base.Splitter$MapSplitter.split(Splitter.java:525)
	at brut.androlib.res.decoder.StyledString$Span.getAttributes(StyledString.java:84)
	at brut.androlib.res.decoder.StyledString$Decoder.decodeIterate(StyledString.java:129)
	at brut.androlib.res.decoder.StyledString$Decoder.decode(StyledString.java:116)
	at brut.androlib.res.decoder.StyledString.toString(StyledString.java:48)
	at brut.androlib.res.decoder.StringBlock.getHTML(StringBlock.java:145)
	at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:482)
	at brut.androlib.res.decoder.ARSCDecoder.readEntryData(ARSCDecoder.java:385)
	at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:340)
	at brut.androlib.res.decoder.ARSCDecoder.readResourceTable(ARSCDecoder.java:96)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:44)
	at brut.androlib.res.data.ResTable.loadResPackagesFromApk(ResTable.java:182)
	at brut.androlib.res.data.ResTable.loadMainPkg(ResTable.java:134)
	at brut.androlib.res.ResourcesDecoder.decodeResources(ResourcesDecoder.java:147)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:104)
	at brut.apktool.Main.cmdDecode(Main.java:217)
	at brut.apktool.Main.main(Main.java:92)

Steps to Reproduce

  1. Add this to your strings.xml:
<string name="styled_string_single_values_0"><paragraph style="font–size:16px;">Paragraph</paragraph></string>
<string name="styled_string_single_values_1"><paragraph style="color:#00a652;">Paragraph</paragraph></string>
<string name="styled_string_double_values_0"><paragraph style="font–size:16px;color:#00a652;">Paragraph</paragraph></string>
<string name="styled_string_double_values_1"><paragraph style="color:#00a652;font–size:16px;">Paragraph</paragraph></string>
<string name="styled_string_double_values_2"><paragraph style="font–size:16px; color:#00a652;">Paragraph</paragraph></string>
<string name="styled_string_double_values_3"><paragraph style="color:#00a652; font–size:16px;">Paragraph</paragraph></string>
  1. Run apktool d styled-strings.apk.

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

APK

If this APK can be freely shared, please upload/attach a link to it.
styled-strings.apk.zip

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? Yes.
  2. If you are trying to install a modified apk, did you resign it? N/A
  3. Are you using the latest apktool version? Yes.
@iBotPeaches
Copy link
Owner

Thanks for the sample. Guess this new styled string handling is full of edge cases.

Possible duplicate: #2890

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