Open GoogleCodeExporter opened 9 years ago
Hmm, look like attaching an APK is not working.
Uploaded it here: https://www.androidfilehost.com/?fid=95897840722645900
Original comment by gamer0...@live.nl
on 19 Jan 2015 at 1:53
Duplicated. Decoded, Rebuilt. Decoded Rebuilt application and noticed the
changes in all arrays.xml files.
Inline double quotes are stripped from <item> values.
Original comment by connor.tumbleson
on 19 Jan 2015 at 2:37
So I took a peek at this yesterday and not sure if this warrants a change.
Double quotes inside of array <items> must be escaped.
This is not.
What I mean is this. We can assume the original string is something like this.
<item><g id="issue_750">%s</g> and <g id="issue_750b">%s</g> foo</item>
Now according to documentation -
http://developer.android.com/guide/topics/resources/string-resource.html#Formatt
ingAndStyling
<, &, " must be escaped.
This means this strings turns into
<item><g id=\"issue_750\">%s</g> and <g id=\"issue_750\">%s</g> foo</item>
You put that string into our unit-tests and there is no error. It is properly
handled. However, the string in this case (post decompiled) is
<item><g id="issue_750">%s</g> and <g id="issue_750">%s</g> foo</item>
As you can see the double quotes are not escaped. With this string above, I can
duplicate the problem, however at that point we are writing bad code. So is it
up to Apktool to fix this?
For example. I built a test apk with this arrays.xml file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="issue_750" formatted="false">
<item><g id="issue_750">%s</g> and <g id="issue_750b">%s</g> foo</item>
<item><g id=\"issue_750\">%s</g> and <g id=\"issue_750b\">%s</g> foo</item>
</string-array>
</resources>
I compiled the apk in release mode and used (aapt d --values resources) to see
the resources post compiled
resource 0x7f040000 com.ibotpeaches.issue750:array/issue_750: <bag>
Parent=0x00000000(Resolved=0x7f000000), Count=2
#0 (Key=0x02000000): (string8) "<g id=issue_750>%s</g> and <g id=issue_750b>%s</g> foo"
#1 (Key=0x02000001): (string8) "<g id=\"issue_750\">%s</g> and <g id=\"issue_750b\">%s</g> foo"
That is what I found. As you can see, the non escaped <item> is lacking the
double quotes because they weren't escaped.
Now on the flipside of the coin. The original apk works, but the decompiled and
built one doesn't. This exposes a fact that apktool has a chance to fix this
poor markup. Since it would be a pain in the ass to manually fix these for
APKs, I will see if its easy to do.
Original comment by connor.tumbleson
on 30 Jan 2015 at 1:19
Original comment by connor.tumbleson
on 3 Feb 2015 at 9:56
Original issue reported on code.google.com by
gamer0...@live.nl
on 19 Jan 2015 at 1:09