berkus / android-apktool

Automatically exported from code.google.com/p/android-apktool
Other
1 stars 0 forks source link

Decompilation introduces quotes into string resources in res/values/strings.xml #204

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Download 
http://www.freewarelovers.com/android/download/temp/1298727501_Guns-n-Glory_FREE
_1.5.1.apk  (too big to attach to the bug)

1. Decompile the APK file using apktool v1.4.1
2. browser to the "res/values/strings.xml"
3. There is a string with the text "Did you hear that terrible crash in the 
mountains."

4. In version 1.4.1 of apktool, the string has quotes at the beginning and end 
of the text. In version 1.3.1, it did not. These quotes are visible in the text 
in the running application post-recompilation, and look like they shouldn't be 
there.

Original issue reported on code.google.com by ericch...@gmail.com on 11 Aug 2011 at 11:20

GoogleCodeExporter commented 9 years ago
As far as I know it's perfectly ok. Also above string is identical in original 
and rebuilt file. You can check this about by yourself using: "aapt d --values 
resources Guns-n-Glory_FREE_1.5.1.apk" command.

Original comment by Brut.alll on 12 Aug 2011 at 8:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi there,

Our method for diagnosing this problem was to install Guns N'Glory, examine 
resources in the running app, then decompile it using APKTOOL, recompile it 
without changing anything and reinstall it and run it. This process introduces 
quotes in v 1.4.1 where it didn't in 1.3.1. You can in the image attached - on 
the left is the output from Apktool 1.3.1 and on the right is 1.4.1

Original comment by ericch...@gmail.com on 16 Aug 2011 at 3:54

Attachments:

GoogleCodeExporter commented 9 years ago
Hmm, I've checked this and I don't see these quotes in the game. What's your 
version of aapt tool? I mean: which sdk level, not "aapt version" command. Also 
could you run "aapt d --values resources Guns-n-Glory_FREE_1.5.1.apk" on a 
recompiled file and search for T_APPNAME?

Original comment by Brut.alll on 16 Aug 2011 at 7:25

GoogleCodeExporter commented 9 years ago
happens to me as well
when decompiling ClockPackage.apk
ver 1.3.1 works fine
ver 1.4.1 add quotes to two values in /res/values/strings.xml
difference can be seen if decompiling with both versions and using a file diff 
program.

this cause apk to crash whenever I set an alarm.

Original comment by tzafri...@gmail.com on 21 Aug 2011 at 7:36

Attachments:

GoogleCodeExporter commented 9 years ago
@tzafrir11
Are you sure crash was caused by these quotes? As I said I have changed the way 
apktool decodes strings, so its pretty normal that output of v1.3.1 and v1.4.1 
differs.

AFAIK new strings encoding works well.

Original comment by Brut.alll on 5 Nov 2011 at 9:19

GoogleCodeExporter commented 9 years ago
I'm attaching a different file.
think the previous one was not the correct.

I decompile using 1.4.1
compile
push resources.arsc from compiled to the original
push to device -> it's broken.

I think this is the strings because if I decompile
and copy the strings.xml and arrays.xml to a different rom (trying to copy 
language translations) it breaks the app
but if I use strings.xml and arrays.xml from different source trying to patch 
translations to the same apk - it works well.

comparing now the two files
i see this difference in strings.xml
<string name="alarm_name_limit">עד %d תווים זמינים</string>
<string name="alarm_name_limit">עד %1$d תווים זמינים</string>
mainly %s instead of %s$1
and in arrays.xml
many places that have ' as part of the value string
are quoted on the file that breaks (<tag>"te'xt"</tag>)
and unquoted on the working file (<tag> tex't</tag>)

thank you for looking into it

Original comment by tzafri...@gmail.com on 6 Nov 2011 at 6:53

Attachments:

GoogleCodeExporter commented 9 years ago
@tzafrir11
Works for me - it's "עד %d תווים זמינים" after rebuilding. Are you 
sure you're using apktool 1.4.1? Run "apktool" and look at the top of usage 
help.

Original comment by Brut.alll on 6 Nov 2011 at 11:01

GoogleCodeExporter commented 9 years ago
yes. its ver 1.4.1
after recompiling and switiching the resources.arsc from the compiled file to 
the original file
push file to device, enter clock, and set an alaram for 7 am (time which is 
before current time)
when you press ok - app force close.

Original comment by tzafri...@gmail.com on 7 Nov 2011 at 5:40

GoogleCodeExporter commented 9 years ago
I have a similar problem with ClockPackage.apk (you can check it with one 
supplied above).

When you decompile with 1.3.1 check the arrays.xml. you will see (for example) 
the line <item>This alarm is set for %1$s, %2$s, and %3$s from now</item>.
When I decompile with 1.4.1 and test release 1.4.2 I get: <item>This alarm is 
set for %1$1$s, %2$$2s, and %3$$3s from now</item>
This difference causes FC when trying to set an alarm for example.

I found this bug with several system apks such as mms.apk clockpackage.apk
It is found mainly in arrays.xml and plurals.apk 

Original comment by fire...@gmail.com on 29 Nov 2011 at 10:54

GoogleCodeExporter commented 9 years ago

Original comment by connor.tumbleson on 19 Nov 2012 at 11:01