Android 4.1 java.lang.VerifyError:

时间:2012-07-08 07:26:30

标签: android android-4.2-jelly-bean

刚刚将我的SDK更新到r20并希望在Ice Cream Sandwich 4.1模拟器上测试我的应用程序。当我的应用程序崩溃时只尝试创建一个新数据库时,我只获得6行:

 gradeBookDbAdapter mDbHelper = new gradeBookDbAdapter(this);  <--- fails here

 private static class DatabaseHelper extends SQLiteOpenHelper {

    DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    public gradeBookDbAdapter(Context ctx) {                <-- but it never gets here
    this.mCtx = ctx;
    }
  <snip...</snip>

在崩溃之前,我甚至无法使用构造函数的任何可执行代码     “java.lang.VerifyError的:”

我正在使用外部库Jexecelapi来读/写Excel文件。自从我第一次将它包含在3个主要版本之前,这一直在完美地运作。但现在我的LogCat说:

07-08 18:21:38.185: I/dalvikvm(861): Could not find method jxl.Workbook.getWorkbook,     referenced from method com.ulsanonline.gradebook2.gradeBookDbAdapter.readExcel
07-08 18:21:38.185: W/dalvikvm(861): VFY: unable to resolve static method 1084: Ljxl/Workbook;.getWorkbook (Ljava/io/File;)Ljxl/Workbook;
07-08 18:21:38.185: D/dalvikvm(861): VFY: replacing opcode 0x71 at 0x001b
07-08 18:21:38.185: W/dalvikvm(861): VFY: unable to resolve exception class 290 (Ljxl/read/biff/BiffException;)
07-08 18:21:38.185: W/dalvikvm(861): VFY: unable to find exception handler at addr 0x5c
07-08 18:21:38.185: W/dalvikvm(861): VFY:  rejected Lcom/ulsanonline/gradebook2/gradeBookDbAdapter;.readExcel (Ljava/lang/String;)V
07-08 18:21:38.185: W/dalvikvm(861): VFY:  rejecting opcode 0x0d at 0x005c
07-08 18:21:38.185: W/dalvikvm(861): VFY:  rejected Lcom/ulsanonline/gradebook2/gradeBookDbAdapter;.readExcel (Ljava/lang/String;)V
07-08 18:21:38.185: W/dalvikvm(861): Verifier rejected class Lcom/ulsanonline/gradebook2/gradeBookDbAdapter;
07-08 18:21:38.195: D/AndroidRuntime(861): Shutting down VM
07-08 18:21:38.195: W/dalvikvm(861): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
07-08 18:21:38.205: E/AndroidRuntime(861): FATAL EXCEPTION: main
07-08 18:21:38.205: E/AndroidRuntime(861): java.lang.VerifyError: com/ulsanonline/gradebook2/gradeBookDbAdapter

所以我在第一篇文章中没有注意到崩溃上方的logcat文本,只是从主要错误南方出发。我的图书馆现在失败的原因是什么?

2 个答案:

答案 0 :(得分:1)

结果是新的SDK我必须把我引用的库放在/ libs文件夹中。这似乎有固定的东西。 -

答案 1 :(得分:0)

1.在项目目录中打开 .classpath 文件。

2.将 exported =“true”添加到 classpathentry 标记中。 如:

旧: classpathentry kind =“lib”path =“libs / httpmime-4.0.1.jar”

新: classpathentry exported =“true” kind =“lib”path =“libs / httpmime-4.0.1.jar”

3.save并重试。