This error (java.lang.VerifyError) occurs when incompatible resources exist, such as interface / class / libs files, improper inheritance / encapsulation of static / instance level identifiers as variables / methods / arguments / classes / files.
This problem comes from a simple violation of the design principles of OOP in code. Thus, the code is rejected by the jvm validation process and throws a validation error at runtime. If you carefully study the stacktrace stack, an instance of class-A (com.example.xmlparsertest.MainActivity) is created by jvm stack [java.lang.Class.newInstanceImpl (native method) ... java.lang.Class. newInstance ...]. This class is referenced or claimed by other classes in violation of design principles, which is why the class cannot receive an instance.
08-09 14:36:47.854: W/dalvikvm(396): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 08-09 14:36:47.873: E/AndroidRuntime(396): FATAL EXCEPTION: main 08-09 14:36:47.873: E/AndroidRuntime(396): java.lang.VerifyError: com.example.xmlparsertest.JavaModBusTcpDriver 08-09 14:36:47.873: E/AndroidRuntime(396): at com.example.xmlparsertest.MainActivity.<init>(MainActivity.java:13) 08-09 14:36:47.873: E/AndroidRuntime(396): at java.lang.Class.newInstanceImpl(Native Method) 08-09 14:36:47.873: E/AndroidRuntime(396): at java.lang.Class.newInstance(Class.java:1429) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.os.Handler.dispatchMessage(Handler.java:99) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.os.Looper.loop(Looper.java:123) 08-09 14:36:47.873: E/AndroidRuntime(396): at android.app.ActivityThread.main(ActivityThread.java:4627) 08-09 14:36:47.873: E/AndroidRuntime(396): at java.lang.reflect.Method.invokeNative(Native Method) 08-09 14:36:47.873: E/AndroidRuntime(396): at java.lang.reflect.Method.invoke(Method.java:521) 08-09 14:36:47.873: E/AndroidRuntime(396): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 08-09 14:36:47.873: E/AndroidRuntime(396): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 08-09 14:36:47.873: E/AndroidRuntime(396): at dalvik.system.NativeStart.main(Native Method)
These warnings cannot be ignored, as these warnings cause FATAL EXCEPTIONS. Dalvikvm engineers have implemented OOP principles as Sun Engineers Done. There are various blogs / forums where people say they ignore this warning. Therefore, do not ignore these warnings and correct them, especially for medical / banking / field applications, or this warning leads to a violation of the Application.
Repeat verification of implemented OOP design principles (e.g. inheritance / encapsulation / polymorphism, etc.) in the code. I was asked to check and fix such errors in a large multi-module Android application, and I found many design violations.
The first trigger to solve such problems makes everything publicly / nonfinally connected with the class that falls into FATAL ERROR. Once you decide, then implement your design principles one by one, and you will get a free application.
Thanks, Vinod Bherwal (Android Architect).
vinod bherwal
source share