I build an android app. For some reason I get VerifyError on some devices (for instance Samsung Galaxy), and not on other devices (for example on Nexus 5).
The exception is thrown over this line:
AdManager.getInstance().preInit();
The exeption stack is:
java.lang.VerifyError: org/example/crossword/Ads/AdManager
at org.example.crossword.PuzzleActivity.onCreate(PuzzleActivity.java:55)
at android.app.Activity.performCreate(Activity.java:5255)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2213)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
at android.app.ActivityThread.access$700(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
After trying to identify what causes the problem, I noticed that I have the line:
catch (ReflectiveOperationException e) { ...
When I remove this line, and use general Exception instead, the VerifyError doesn't occur.
So, I'm wondering why does the ReflectiveOperationException causes this error on some devices?