youleyu / android-apktool

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

java.lang.StringIndexOutOfBoundsException #169

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Grab Settings.apk from Leaked Incredible 2.3.3 Sense Build 
(http://forum.xda-developers.com/showthread.php?t=1087077)
2. use apktool 4.1 to install framework-res.apk and com.htc.resources.apk in 
this rom first
  $ apktool if framework-res.apk
  $ apktool if framework-res.apk
3. Use same apktool to decode Settings.apk
  $ apktool d Settings.apk

What is the expected output? What do you see instead?
 apktool failed to decode and output:
$ apktool d Settings.apk 
I: Baksmaling...
I: Loading resource table...
W: Skipping "android" package group
I: Loaded.
I: Loading resource table from file: /home/yueche/apktool/framework/1.apk
I: Loaded.
I: Loading resource table from file: /home/yueche/apktool/framework/2.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String 
index out of range: 21
    at java.lang.String.charAt(String.java:686)
    at brut.androlib.res.xml.ResXmlEncoders.findNonPositionalSubstitutions(ResXmlEncoders.java:165)
    at brut.androlib.res.xml.ResXmlEncoders.enumerateNonPositionalSubstitutions(ResXmlEncoders.java:142)
    at brut.androlib.res.data.value.ResStringValue.encodeAsResXmlValue(ResStringValue.java:45)
    at brut.androlib.res.data.value.ResArrayValue.serializeToResValuesXml(ResArrayValue.java:55)
    at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:264)
    at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137)
    at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
    at brut.apktool.Main.cmdDecode(Main.java:120)
    at brut.apktool.Main.main(Main.java:57)

What version of the product are you using? On what operating system?
apktool 4.1, ubuntu10.0.4
$ uname -a
 Linux yueche-desktop 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC 2010 x86_64 GNU/Linux

Please provide any additional information below.
You can contact me (godsarmycy@gmail.com) for details if necessary 

Original issue reported on code.google.com by godsarm...@gmail.com on 22 May 2011 at 7:49

GoogleCodeExporter commented 9 years ago
I have fixed this some time ago. http://www.multiupload.com/BPJW0WGTBG - should 
be ok.

Original comment by Brut.alll on 22 May 2011 at 3:41

GoogleCodeExporter commented 9 years ago
Issue 171 has been merged into this issue.

Original comment by Brut.alll on 24 May 2011 at 10:27

GoogleCodeExporter commented 9 years ago
how date to release new version?

Original comment by gaochun...@gmail.com on 24 May 2011 at 12:30

GoogleCodeExporter commented 9 years ago
Hi Brut

Thanks for the update. I have tried your prebuilt 1.4.2 version. It works 
perfectly. 

Original comment by godsarm...@gmail.com on 25 May 2011 at 2:12

GoogleCodeExporter commented 9 years ago
"how date to release new version?"

I don't rush, there are just 2 bug fixes for v1.4.1 for now. I'll release 
v1.4.2 when there will be something more or if many people will get above 
problems.

Original comment by Brut.alll on 25 May 2011 at 4:34

GoogleCodeExporter commented 9 years ago
Issue 172 has been merged into this issue.

Original comment by Brut.alll on 26 May 2011 at 6:59

GoogleCodeExporter commented 9 years ago
same issue again, plz release new version. ;-)

Original comment by gaochun...@gmail.com on 27 May 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Yeah, I think you're right ;-)

Original comment by Brut.alll on 27 May 2011 at 9:33

GoogleCodeExporter commented 9 years ago
Hi Brut,

godsarmy references a prebuilt v1.4.2, but I can't seem to find this? Could you 
please link me? I'm receiving the same error.

thx

Original comment by sagui.g...@gmail.com on 27 May 2011 at 2:00

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/android-apktool/issues/detail?id=169#c1

Original comment by Brut.alll on 27 May 2011 at 3:31

GoogleCodeExporter commented 9 years ago
why release new version not yet?

Comment 7 by gaochun...@gmail.com, May 27 (3 days ago)
same issue again, plz release new version. ;-)
Comment 8 by project member Brut.alll, May 27 (3 days ago)
Yeah, I think you're right ;-)

Original comment by gaochun...@gmail.com on 31 May 2011 at 3:51

GoogleCodeExporter commented 9 years ago
Same error here. Please release a fix :)

Original comment by ninn...@gmail.com on 27 Jun 2011 at 2:12

GoogleCodeExporter commented 9 years ago
Try to download the url from Comment 1 by Brut.All, it fix my problem...

Original comment by Yk.hand...@gmail.com on 29 Jun 2011 at 1:47

GoogleCodeExporter commented 9 years ago
got the same error but updated apktool.jar to the one linked to in comment 
#1--worked like a charm. thanks brut.alll!

Original comment by redballp...@gmail.com on 29 Jun 2011 at 11:25

GoogleCodeExporter commented 9 years ago
Same error here. Got the file from first post. BAM fixed!

Original comment by c.a.lope...@gmail.com on 22 Jul 2011 at 4:35

GoogleCodeExporter commented 9 years ago
Brut.all this is experienced in alot of decompile's this could be an excellent 
reason to release this

Original comment by nvrsumme...@gmail.com on 6 Sep 2011 at 4:54

GoogleCodeExporter commented 9 years ago
-----------------------------------------------------
[*] Phone.apk
-----------------------------------------------------
Decompiling Phone.apk...
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Ismet\apktool\framework\1.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=theme, value=0x010300e7
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=theme, value=0x010300e7
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=theme, value=0x010300e7
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=theme, value=0x010300e7
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=theme, value=0x010300e7
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=theme, value=0x010300e7
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=textColor, value=0x01060080
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=textColor, value=0x01060081
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=textAppearance, value=0x010300b2
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=textAppearance, value=0x010300b2
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=title, value=0x010403c1
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=layout_width, value=0x01050019
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=layout_height, value=0x01050019
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=id, value=0x01020232
W: Could not decode attr value, using undecoded value instead: ns=android, 
name=textColor, value=0x01060080
I: Decoding values*/* XMLs...
I: Done.
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec: 
0x010300e7
    at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
    at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:55)
    at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:51)
    at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferenceValue.java:59)
    at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResReferenceValue.java:46)
    at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResScalarValue.java:43)
    at brut.androlib.res.decoder.ResAttrDecoder.decode(ResAttrDecoder.java:40)
    at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(AXmlResourceParser.java:315)
    at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValue(XmlPullParserDelegate.java:69)
    at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
    at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
    at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:46)
    at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
    at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
    at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:114)
    at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
    at brut.apktool.Main.cmdDecode(Main.java:120)
    at brut.apktool.Main.main(Main.java:57)
Done!

Original comment by ismet.er...@gmail.com on 9 Sep 2011 at 6:18

GoogleCodeExporter commented 9 years ago
Just want to add for history (cause 1.4.2 fix it too)

$ apktool d -f miui.glacier.1.9.9.en/system/app/Mms.apk mms.unpacked 
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /home/astar/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String 
index out of range: 3
    at java.lang.String.charAt(String.java:694)
    at brut.androlib.res.xml.ResXmlEncoders.findNonPositionalSubstitutions(ResXmlEncoders.java:165)
    at brut.androlib.res.xml.ResXmlEncoders.enumerateNonPositionalSubstitutions(ResXmlEncoders.java:142)
    at brut.androlib.res.data.value.ResStringValue.encodeAsResXmlValue(ResStringValue.java:45)
    at brut.androlib.res.data.value.ResArrayValue.serializeToResValuesXml(ResArrayValue.java:55)
    at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:264)
    at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137)
    at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
    at brut.apktool.Main.cmdDecode(Main.java:120)
    at brut.apktool.Main.main(Main.java:57)

Original comment by stari...@gmail.com on 18 Sep 2011 at 6:23

GoogleCodeExporter commented 9 years ago
For heaven's sake, please release this as apktool 1.4.2! I almost didn't see 
this because it doesn't officially exist anywhere. And it just happens to fix 
all the issues I've been having recompiling themed framework-res.apk's!

Original comment by primetechv2 on 21 Sep 2011 at 6:26

GoogleCodeExporter commented 9 years ago
You should upgrade the main project to 1.4.2!  I also had this problem, when 
working on a patch of the com.android.vending update.  The first link fixed it 
(glad I googled the exception!).

For the record here is the exception I saw

I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /Users/apf/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String 
index out of range: 3
    at java.lang.String.charAt(String.java:686)
    at brut.androlib.res.xml.ResXmlEncoders.findNonPositionalSubstitutions(ResXmlEncoders.java:165)
    at brut.androlib.res.xml.ResXmlEncoders.hasMultipleNonPositionalSubstitutions(ResXmlEncoders.java:138)
    at brut.androlib.res.data.value.ResStringValue.serializeExtraXmlAttrs(ResStringValue.java:63)
    at brut.androlib.res.data.value.ResScalarValue.serializeToResValuesXml(ResScalarValue.java:65)
    at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:264)
    at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137)
    at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
    at brut.apktool.Main.cmdDecode(Main.java:120)
    at brut.apktool.Main.main(Main.java:57)

Original comment by adrienne...@gmail.com on 7 Oct 2011 at 4:00

GoogleCodeExporter commented 9 years ago
FWIW, 1.4.2 did NOT fix it for me:

Oct 19, 2011 6:13:14 PM brut.androlib.Androlib decodeSourcesSmali
INFO: Baksmaling...
Oct 19, 2011 6:13:15 PM brut.androlib.res.AndrolibResources loadMainPkg
INFO: Loading resource table...
Oct 19, 2011 6:13:15 PM brut.androlib.res.AndrolibResources loadMainPkg
WARNING: Skipping "android" package group
Oct 19, 2011 6:13:15 PM brut.androlib.res.AndrolibResources loadMainPkg
INFO: Loaded.
Oct 19, 2011 6:13:15 PM brut.androlib.res.AndrolibResources loadFrameworkPkg
INFO: Loading resource table from file: /home/cweight/apktool/framework/1.apk
Oct 19, 2011 6:13:16 PM brut.androlib.res.AndrolibResources loadFrameworkPkg
INFO: Loaded.
Oct 19, 2011 6:13:16 PM brut.androlib.res.AndrolibResources decode
INFO: Decoding file-resources...
Oct 19, 2011 6:13:16 PM brut.androlib.res.AndrolibResources decode
INFO: Decoding values*/* XMLs...
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec: 
0x7f010079
    at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
    at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:55)
    at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:51)
    at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferenceValue.java:59)
    at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResReferenceValue.java:46)
    at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResScalarValue.java:43)
    at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(ResStyleValue.java:48)
    at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:264)
    at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137)
    at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
    at brut.apktool.Main.cmdDecode(Main.java:120)
    at brut.apktool.Main.main(Main.java:57)

Original comment by cweight on 20 Oct 2011 at 1:18

GoogleCodeExporter commented 9 years ago
Hi, when will 1.4.2 be released officially?

Original comment by r4m...@gmail.com on 4 Nov 2011 at 8:59

GoogleCodeExporter commented 9 years ago
1.4.2 did not fix it for me too:

I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\mist\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind
ex out of range: 37
        at java.lang.String.charAt(Unknown Source)
        at brut.androlib.res.xml.ResXmlEncoders.findNonPositionalSubstitutions(ResXmlEncoders.java:165)
        at brut.androlib.res.xml.ResXmlEncoders.hasMultipleNonPositionalSubstitutions(ResXmlEncoders.java:138)
        at brut.androlib.res.data.value.ResStringValue.serializeExtraXmlAttrs(ResStringValue.java:63)
        at brut.androlib.res.data.value.ResScalarValue.serializeToResValuesXml(ResScalarValue.java:65)
        at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:264)
        at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137)
        at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
        at brut.apktool.Main.cmdDecode(Main.java:120)
        at brut.apktool.Main.main(Main.java:57)

Original comment by martin....@gmail.com on 5 Nov 2011 at 11:46

GoogleCodeExporter commented 9 years ago
Sorry all for waiting.

@cweight
Your issue isn't a StringIndexOutOfBoundsException.

@martin.nuc
Could you upload this apk?

Original comment by Brut.alll on 5 Nov 2011 at 6:58

GoogleCodeExporter commented 9 years ago

Original comment by Brut.alll on 5 Nov 2011 at 6:58

GoogleCodeExporter commented 9 years ago
@Brut.alll: sure. Attached.

Original comment by martin....@gmail.com on 5 Nov 2011 at 7:02

Attachments:

GoogleCodeExporter commented 9 years ago
@martin.nuc
Works for me - are you sure you are using apktool from first comment? Run 
apktool command and look for version at the top of usage help.

Original comment by Brut.alll on 5 Nov 2011 at 8:31

GoogleCodeExporter commented 9 years ago
Oh damn. My bad. Sorry... You are of course right. I have copy of old apktool 
somewhere in path because it says version 1.4.1. Dumb mistake. Sorry again.

Original comment by martin....@gmail.com on 5 Nov 2011 at 8:35

GoogleCodeExporter commented 9 years ago
Issue 196 has been merged into this issue.

Original comment by Brut.alll on 5 Nov 2011 at 8:55

GoogleCodeExporter commented 9 years ago
Issue 203 has been merged into this issue.

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

GoogleCodeExporter commented 9 years ago
Issue 208 has been merged into this issue.

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

GoogleCodeExporter commented 9 years ago
Issue 221 has been merged into this issue.

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

GoogleCodeExporter commented 9 years ago
It's ok :-)

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

GoogleCodeExporter commented 9 years ago
Issue 238 has been merged into this issue.

Original comment by Brut.alll on 28 Nov 2011 at 11:18

GoogleCodeExporter commented 9 years ago
Issue 239 has been merged into this issue.

Original comment by Brut.alll on 28 Nov 2011 at 11:22

GoogleCodeExporter commented 9 years ago
Issue 241 has been merged into this issue.

Original comment by Brut.alll on 28 Nov 2011 at 11:25