Rjaibi Mejdi
Rjaibi Mejdi

Reputation: 6880

Error When building App Method code too large

I imported my project from existent code. I didn't do any modification but when I build the application there is the error:

:XXXXPlayer:transformClassesWithInstantRunForDebug FAILED FAILURE: Build failed with an exception.

*What went wrong: Execution failed for task ':xxxxPlayer:transformClassesWithInstantRunForDebug'.

Method code too large!

Any idea?

Upvotes: 2

Views: 5114

Answers (2)

Muhammad Saqib Javed
Muhammad Saqib Javed

Reputation: 305

Error is producing because you have added many dependencies.

First a java class name what you want for example ApplicationDelegate and extends with MultiDexApplication. Open android manifest file add this class name 'android:name=".ApplicationDelegate"' in Application Tag.!

Upvotes: 0

Bipin Bhandari
Bipin Bhandari

Reputation: 2692

You should break your function into different functions. It is really bad design to create one large method.

Error is thrown because there is a 64K byte-code size limit on a method in Java.

There could be helpful http://chrononsystems.com/blog/method-size-limit-in-java

Also checkout solution proposed in this answer "Code too large" compilation error in Java

Upvotes: 0

Related Questions