VFY: cannot find the class specified in the signature

I have a simple Android application that uses the modbus library ("jamod") in the build path. It fires immediately when I run it. I basically have the same problem in this question: Getting "Called: java.lang.VerifyError:"

But I can not fix this problem. My application worked well before, now, no matter what I do, it does not work.

Below is the output of logcat. Thanks in advance.

08-09 14:36:47.753: W/dalvikvm(396): VFY: unable to find class referenced in signature (Lnet/wimpi/modbus/net/TCPMasterConnection;) 08-09 14:36:47.823: W/dalvikvm(396): VFY: unable to resolve exception class 510 (Lnet/wimpi/modbus/ModbusIOException;) 08-09 14:36:47.823: W/dalvikvm(396): VFY: unable to find exception handler at addr 0x18 08-09 14:36:47.854: W/dalvikvm(396): VFY: rejected Lcom/example/xmlparsertest/JavaModBusTcpDriver;.<init> (Ljava/lang/String;I)V 08-09 14:36:47.854: W/dalvikvm(396): VFY: rejecting opcode 0x0d at 0x0018 08-09 14:36:47.854: W/dalvikvm(396): VFY: rejected Lcom/example/xmlparsertest/JavaModBusTcpDriver;.<init> (Ljava/lang/String;I)V 08-09 14:36:47.854: W/dalvikvm(396): Verifier rejected class Lcom/example/xmlparsertest/JavaModBusTcpDriver; 08-09 14:36:47.854: D/AndroidRuntime(396): Shutting down VM 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) 
+8
android jar
source share
4 answers

Did you put the jamod jar file in the "libs" directory in Eclipse? If not, this will not be included in your application, even if it is in the way at compile time. This is a fairly new change.

+4
source share

One thing that needs to be checked twice is to check the box for jar files on the Order and Export tab in the Build Path window. This will include the library in the built APK.

+15
source share

I had similar errors of VFY, link and def class, but all my libraries were in the β€œLIB” folder and added them to the build path, and ECLIPSE could easily find them at compile time, but when they were deployed on a real device, it gave Problems. Decision. Make sure the library files are located in the "libs" folder, and not in the "lib" or "library" in the ECLIPSE project.

+1
source share

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).

0
source share

All Articles