3

I am migrating from Eclipse to Android Studio, and now my application crashes, with the Logcat showing different reasons for different phones, but focusing on a very large method I have. For example:

Android 6.0.1 phone:

java.lang.VerifyError: Verifier rejected class due to bad method

Android 2.3.6 phone:

W/dalvikvm: VFY: warning: method is huge (regs=466 insnsSize=25467)

Using Eclipse I did not have problems from Android 2.3.6 onwards (my application only crashed in phones with versions of Android below 2.3.6). Now in Android Studio, my application crashes in all versions of Android.

I have read that the size of the file should not give errors for Android versions 2.3.6 and above. That was true with Eclipse. I am new to Android Studio; maybe there is a compatibility issue easy to solve?

ADVICE: I decided to refactor the method and solved the problem.

  • [_"When the number of enum constants is higher than 2000, eclipse generates synthetic methods to work around the code size limit."_](https://stackoverflow.com/a/50504573/6505250) – howlger Jun 08 '18 at 08:53
  • Thank you @howlger; is the 64K limit the same as the 2^21 limit in (number of registers)*(number of instructions)? In https://stackoverflow.com/questions/4748771/how-to-solve-android-verify-error it seems that Android lifted the 2^21 limit long time ago (or maybe it was the Eclipse compiler rather than Android who lifted the 2^21 limit?) – user9912884 Jun 08 '18 at 16:27
  • Even if the error occurs when converting to Dalvik code, I guess that it is already due to the different bytecode. I think Eclipse and Android Studio differ in the Java compiler (Eclipse Java compiler vs. javac) but probably not in the conversion to Dalvik code. But that's just a guess, and I'm sorry I can't answer your question. – howlger Jun 08 '18 at 17:03

0 Answers0