dex2jar icon indicating copy to clipboard operation
dex2jar copied to clipboard

java.lang.StringIndexOutOfBoundsException: String index out of range: -2

Open WaqasAzamKml opened this issue 3 years ago • 20 comments

java.lang.StringIndexOutOfBoundsException: String index out of range: -2
        at java.lang.String.substring(Unknown Source)
        at org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:169)
        at org.objectweb.asm.signature.SignatureReader.acceptType(SignatureReader.java:130)
        at org.objectweb.asm.commons.Remapper.mapSignature(Remapper.java:162)
        at org.objectweb.asm.commons.RemappingClassAdapter.visitField(RemappingClassAdapter.java:90)
        at org.objectweb.asm.ClassVisitor.visitField(ClassVisitor.java:272)
        at com.googlecode.d2j.dex.Dex2Asm.convertField(Dex2Asm.java:488)
        at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:439)
        at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:357)
        at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:460)
        at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:175)
        at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:275)
        at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:112)
        at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:290)
        at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:33)

P.S: I'm trying to use this tool on a classes.dex file extracted from an APK which was mainly programmed in Kotlin.

WaqasAzamKml avatar Nov 10 '21 16:11 WaqasAzamKml

Bump

WaqasAzamKml avatar Nov 16 '21 19:11 WaqasAzamKml

Please share the appropriate APK/DEX file and test it on my fork of dex2jar: https://github.com/ThexXTURBOXx/dex2jar

ThexXTURBOXx avatar Nov 18 '21 11:11 ThexXTURBOXx

apk.zip

grasmanek94 avatar Nov 18 '21 15:11 grasmanek94

ThexXTURBOXx branch does work on that APK, thanks.

grasmanek94 avatar Nov 18 '21 15:11 grasmanek94

Thanks for your feedback!

@pxb1988 There seems to be something else in my fork that you might want to release in your version as well.

ThexXTURBOXx avatar Nov 18 '21 15:11 ThexXTURBOXx

FYI I just have the same issue, I'm not the issue author or related :)

grasmanek94 avatar Nov 18 '21 15:11 grasmanek94

FYI I just have the same issue, I'm not the issue author or related :)

I will wait for the original author to reply and we will see if his issue is fixed as well :)

ThexXTURBOXx avatar Nov 18 '21 15:11 ThexXTURBOXx

Hi thank you @ThexXTURBOXx for your fork of dex2jar. It gave me following message while converting dex 2 jar

Applying workaround to field Lk/f/b/e/d/f$a;->n:Landroid/view/View; by removing its original signature TV.

Though I got no error while conversion, but in final output classes-dex2jar.jar file, I didn't get R.java class.

WaqasAzamKml avatar Nov 18 '21 18:11 WaqasAzamKml

Thanks for the response @WaqasAzamKml Yes, this message is appropriate as the type can't directly be translated to Java ByteCode from Dalvik. I will take a look at the missing R.java file, though. Are you able to share your APK as well? :)

ThexXTURBOXx avatar Nov 18 '21 19:11 ThexXTURBOXx

Here is my classes.dex file, I would be grateful if you extract most of its code, specially from the package com.appxstudio.esportslogo classes.zip

Link to APK: https://apkpure.com/esports-gaming-logo-maker/com.appxstudio.esportlogo

WaqasAzamKml avatar Nov 18 '21 19:11 WaqasAzamKml

@ThexXTURBOXx any luck with the dex file I sent?

WaqasAzamKml avatar Nov 23 '21 11:11 WaqasAzamKml

Sadly no, I can't seem to find the R.class file either. I will try to see if jadx can successfully recover it at some point. If it also doesn't, then it's most likely not dex2jar's fault :)

ThexXTURBOXx avatar Nov 23 '21 12:11 ThexXTURBOXx

Tested it on jadx. The R.class file is there. So, something goes wrong in Dex2Jar. I will try to investigate this issue whenever I have time :)

ThexXTURBOXx avatar Nov 24 '21 10:11 ThexXTURBOXx

Good luck @ThexXTURBOXx

WaqasAzamKml avatar Nov 24 '21 12:11 WaqasAzamKml

This problem seems to have not been resolved in the new version.

Hackxiaoya avatar Apr 13 '23 13:04 Hackxiaoya

@Hackxiaoya Have you tried my fork? If yes, please provide me with the stack trace

ThexXTURBOXx avatar Apr 14 '23 07:04 ThexXTURBOXx

@ThexXTURBOXx Yes. Your fork solves this problem.But why didn't this repository merge your fixes?

Hackxiaoya avatar Apr 20 '23 16:04 Hackxiaoya

Okay, thanks for the feedback! I provided too many fixes to merge them all at once. So, instead the original author cherry picked only a few ones

ThexXTURBOXx avatar Apr 20 '23 16:04 ThexXTURBOXx

@ThexXTURBOXx you are awesome. your version works on a 300MB apk file.

tonychunxizhu avatar May 02 '23 19:05 tonychunxizhu

Very nice to hear, thanks for the feedback :)

ThexXTURBOXx avatar May 02 '23 20:05 ThexXTURBOXx