pxb1988 / dex2jar

Tools to work with android .dex and java .class files
Apache License 2.0
12.36k stars 2.12k forks source link

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

Open WaqasAzamKml opened 3 years ago

WaqasAzamKml commented 3 years ago
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 commented 3 years ago

Bump

ThexXTURBOXx commented 3 years ago

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

grasmanek94 commented 3 years ago

apk.zip

grasmanek94 commented 3 years ago

ThexXTURBOXx branch does work on that APK, thanks.

ThexXTURBOXx commented 3 years ago

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.

grasmanek94 commented 3 years ago

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

ThexXTURBOXx commented 3 years ago

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 :)

WaqasAzamKml commented 3 years ago

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.

ThexXTURBOXx commented 3 years ago

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? :)

WaqasAzamKml commented 3 years ago

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 commented 2 years ago

@ThexXTURBOXx any luck with the dex file I sent?

ThexXTURBOXx commented 2 years ago

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 commented 2 years ago

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 :)

WaqasAzamKml commented 2 years ago

Good luck @ThexXTURBOXx

Hackxiaoya commented 1 year ago

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

ThexXTURBOXx commented 1 year ago

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

Hackxiaoya commented 1 year ago

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

ThexXTURBOXx commented 1 year ago

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

tonychunxizhu commented 1 year ago

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

ThexXTURBOXx commented 1 year ago

Very nice to hear, thanks for the feedback :)