致命异常:java.lang.VerifyError:来自导入的jar文件

时间:2014-12-30 13:12:51

标签: java android eclipse jar verifyerror

我正在建立一个我使用第三方jar文件的图书馆项目。

通常当我使用库作为TestApp的依赖时,一切都按预期工作。附件是截图:

Library project dependency which worked

但是,当我从TestSDK库项目中导出jar并将其添加到TestApp的构建路径时,如下所示:

Added jar to build path

Full view of order and export

在设备上部署应用时,我得到VerifyError。以下是它的日志:

12-30 18:10:55.778: W/dalvikvm(7316): VFY: unable to find class referenced in signature (Lcom/aerserv/sdk/ASAdView;)
12-30 18:10:55.788: W/dalvikvm(7316): VFY: Ljava/lang/Object; is not instance of Landroid/view/View;
12-30 18:10:55.788: W/dalvikvm(7316): VFY: bad arg 1 (into Landroid/view/View;)
12-30 18:10:55.788: W/dalvikvm(7316): VFY:  rejecting call to Landroid/view/ViewGroup;.removeView (Landroid/view/View;)V
12-30 18:10:55.788: W/dalvikvm(7316): VFY:  rejecting opcode 0x6e at 0x0011
12-30 18:10:55.788: W/dalvikvm(7316): VFY:  rejected Lcom/anupam/sdk/activities/AdsActivity;.initAerservAd ()V
12-30 18:10:55.788: W/dalvikvm(7316): Verifier rejected class Lcom/anupam/sdk/activities/AdsActivity;
12-30 18:10:55.788: W/dalvikvm(7316): Class init failed in newInstance call (Lcom/anupam/sdk/activities/AdsActivity;)
12-30 18:10:55.788: D/AndroidRuntime(7316): Shutting down VM
12-30 18:10:55.788: W/dalvikvm(7316): threadid=1: thread exiting with uncaught exception (group=0x41596ba8)
12-30 18:10:55.788: E/AndroidRuntime(7316): FATAL EXCEPTION: main
12-30 18:10:55.788: E/AndroidRuntime(7316): Process: com.anupam.testsdk, PID: 7316
12-30 18:10:55.788: E/AndroidRuntime(7316): java.lang.VerifyError: com/anupam/sdk/activities/AdsActivity

这样做的正确方法是什么?我在这里错过了一些东西。任何形式的帮助或指导都将不胜感激。

1 个答案:

答案 0 :(得分:2)

我认为您的JAR依赖于Aerserv SDK,但不包括它。而且我也没有看到它被包含在应用程序中。

请注意,JAR库的构建依赖项不会自动包含在内。构建库时,依赖性是一个问题。您有两个选择:在jar本身中包含依赖项(您必须强制构建系统执行此操作)或指示库用户执行此操作(类似于Aerserv的操作方式)。如果包含依赖项,那么如果库用户也对它们进行广告宣