Comments (11)
I was able to work around this issue with a little elbow grease.
I got the same error as above. I looked at the summary file to find the stack trace:
java.lang.RuntimeException: Method code too large!
at org.objectweb.asm.MethodWriter.getSize(MethodWriter.java:1872)
at org.objectweb.asm.AsmBridge.sizeOfMethodWriter(AsmBridge.java:28)
at com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:55)
at com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:128)
at com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:509)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:406)
at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:422)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:172)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:272)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:108)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)
Next, I found the jar file which contains that class in the lib directory: asm-debug-all-4.1.jar
. Searching for "asm-debug-all-4.1.jar source code" led me here. The relevant snippet of code that's failing is:
if (code.length > 0) {
if (code.length > 65536) {
throw new RuntimeException("Method code too large!"); // CULPRIT
}
cw.newUTF8("Code");
size += 18 + code.length + 8 * handlerCount;
What an odd test! It turns out that the java spec states that java method bodies cannot be longer than 64K, so this library is (rightfully) refusing to compile the method dex2jar
has generated under the covers. But we're just trying to look at source code, not compile a program, so we don't care about that limit. Let's work around it.
The Right Thing here would be to pull down the build here, update the code, recompile it, and replace the class file. However, I -- frankly -- couldn't be arsed to do all that, so I took the much more direct (irresponsible, and lazy) approach of editing the byte code by hand.
Here's what I did:
- Download the latest snapshot as of 2017-02-13, dex2jar-2.1-SNAPSHOT and unzip to
$D2JHOME
- Download a java bytecode editor (I used this one and unzipped to
$BEHOME
) $ cd $D2JHOME
- Back up the relevant library file
$ cp lib/asm-debug-all-4.1.jar lib/asm-debug-all-4.1.jar.orig
$ cd lib
- Extract the MethodWriter class
$ unzip asm-debug-all-4.1.jar org/objectweb/asm/MethodWriter.class
- Launch the bytecode editor and load
org/objectweb/asm/MethodWriter.class
(In another terminal, I used$ cd $BEHOME/bin; $ java ee.ioc.cs.jbe.browser.BrowserApplication
) - In the bytecode editor, navigate to the
getSize()
method - In the bytecode editor, change instruction 23
ldc 65536
to a higher value (Note the code editor tab, I usedldc 524288
) - Save the change in the bytecode editor
- Update the MethodWriter class
$ zip asm-debug-all-4.1.jar org/objectweb/asm/MethodWriter.class
- Re-run
$ $D2JHOME/d2j-dex2jar.sh application.apk -o application.jar --force
- If that number doesn't work, try a bigger one!
Really, whether to enforce this limit or not should be an option in the asm-debug-all
library. In the meantime, I've attached the updated JAR file here. (I had to rename it to ZIP for GitHub to take the file; you'll need to rename it to JAR after you download it.) Back up the existing asm-debug-all-4.1.jar
file, and replace the original with the attached (renamed) file. That should work.
from dex2jar.
@sigpwned
Your solution is awesome but, I'm stuck with a new exception which is
java.lang.ArrayIndexOutOfBoundsException: 255
at org.objectweb.asm.MethodWriter.getSize(MethodWriter.java)
at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:775)
at com.googlecode.d2j.dex.Dex2jar$1$1.visitEnd(Dex2jar.java:101)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:409)
at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:422)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:172)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:272)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:108)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)
I tried to figure it out but I didn't get the point
from dex2jar.
@ammaratef45
Use another bytecode editor.
https://github.com/GraxCode/JByteMod-Beta/releases worked for me.
from dex2jar.
please also attach the m0.txt in the zip file
from dex2jar.
Github doesn't seems to have the option to upload files other than pictures, so I have uploaded the error zip file to google drive. Please look at the attached link.
https://drive.google.com/file/d/0B2U4p41RgtjKRFM2YWIwYW1SanM/view?usp=sharing
from dex2jar.
the method Lcom/nxp/nfc/tagwriter/gc;.<clinit>()V
contains an array, the array size is huge, so the generated instruction can't fit in a .class method.
from dex2jar.
Encounted java.lang.RuntimeException: Method code too large!
Uploaded Classes-error.zip on google drive
https://drive.google.com/open?id=0B0uVD6vxUmjySEhJSmVSSVM2eTA
from dex2jar.
Hi pxb thanks for ur good Job .. I am in new for this circle.
I got same issue. How solve... I am use dex2jar 2.0.
from dex2jar.
I have same problem. I'm using dex2jar Nightly build for dex2jar 20150601
from dex2jar.
Same here. Any idea WRT a fix? or a workaround?
from dex2jar.
The asm-debug-all-4.1.jar
that @sigpwned attached is outdated by now
So you should use this amazing fork which says that it fixed a lot of things and it fixed this unnecessary exception
from dex2jar.
Related Issues (20)
- READ THIS **BEFORE** CREATING ISSUES!
- Detail Error Information in File .\jioJoin-error.zip Please report this file HOT 3
- Dex2Jar issue A13 HOT 2
- READ THIS **BEFORE** CREATING ISSUES! HOT 1
- Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded HOT 1
- jar2dex min sdk version issue HOT 4
- decompile wechat8.0.32 error HOT 1
- E:\resources\classes2.dex
- IndexOutOfBoundsException had happened in using dex-tools-v2.4 tool to decode jar package HOT 1
- java.lang.RuntimeException: fail exe a8 = a3 HOT 1
- error on decompiling HOT 1
- Detail Error Information in File .\00O000ll111l_0-error.zip HOT 1
- 变异过程中遇到的错误 HOT 1
- Method too large during exception HOT 1
- java.lang.IllegalArgumentException: UTF8 string too large HOT 2
- dex2jar: use classes as android library? HOT 4
- So... this thing doesn't work on Windows at all? HOT 5
- There are 1 methods fail to translate. HOT 2
- dex2jar: found bug HOT 4
- org.objectweb.asm.MethodTooLargeException HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dex2jar.