简体   繁体   中英

java heap size error dex2jar android decompile solution?

i was working on a android project but my laptop was formatted so i lost all code but i had a signed apk of the file on my phone .. whenever i try to use dex2jar it stops converting mid way with this error. how can i increase the heap size or is there another way out. can i decompile an apk with the key it was signed with

C:\~dex2jar>d2j-dex2jar --force
classes.dex
dex2jar classes.dex -> classes-dex2jar.jar
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at org.objectweb.asm.Type.getInternalName(Unknown Source)
    at com.googlecode.dex2jar.v3.V3ClassAdapter.searchEnclosing(V3ClassAdapt
er.java:179)
    at com.googlecode.dex2jar.v3.V3ClassAdapter.build(V3ClassAdapter.java:13
0)
    at com.googlecode.dex2jar.v3.V3ClassAdapter.visitField(V3ClassAdapter.ja
va:303)
    at com.googlecode.dex2jar.reader.DexFileReader.acceptField(DexFileReader
.java:603)
    at com.googlecode.dex2jar.reader.DexFileReader.acceptClass(DexFileReader
.java:439)
    at com.googlecode.dex2jar.reader.DexFileReader.accept(DexFileReader.java
:330)
    at com.googlecode.dex2jar.v3.Dex2jar.doTranslate(Dex2jar.java:84)
    at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:239)
    at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:230)
    at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java
:109)
    at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:168)
    at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:34)

Make a copy of the d2j-dex2jar.bat file, and edit it. Find the line that says this:

java -Xms512m -Xmx1024m -cp "%CLASSPATH%" 
            "com.googlecode.dex2jar.tools.Dex2jarCmd" %*

Change the -Xmx parameter to give yourself a larger maxheap size. Save it, and see if your modified BAT file works better. (There isn't an elegant way to override the JVM settings in this script.)

if you use dex2jar-2.0 ,you can find the line that says this:

java -Xms512m -Xmx1024m ******************************* in d2j_invoke.bat instead of d2j_dex2jar.bat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM