我正在使用 greenDao 访问我的 Android 手机中的数据库。一切似乎都很好,并且遵守了。但是当我运行程序时,它在 DaoMaster.java -> OpenHelper 类,onCreate 方法在 createAllTables(db, false); 处崩溃;
以下是异常消息:
>05-03 15:40:34.109: E/AndroidRuntime(28587): FATAL EXCEPTION: main
05-03 15:40:34.109: E/AndroidRuntime(28587): java.lang.NoClassDefFoundError: com.hook38.sporttimer.model.sql.DaoMaster
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.model.sql.DaoMaster$OpenHelper.onCreate(DaoMaster.java:42)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:165)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.controller.CountdownTimerStoreController.<init>(CountdownTimerStoreController.java:32)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.controller.CountdownTimerController.<init>(CountdownTimerController.java:57)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.CountDownTimerActivity.onCreate(CountDownTimerActivity.java:49)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.Activity.performCreate(Activity.java:4465)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.os.Handler.dispatchMessage(Handler.java:99)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.os.Looper.loop(Looper.java:137)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-03 15:40:34.109: E/AndroidRuntime(28587): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 15:40:34.109: E/AndroidRuntime(28587): at java.lang.reflect.Method.invoke(Method.java:511)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-03 15:40:34.109: E/AndroidRuntime(28587): at dalvik.system.NativeStart.main(Native Method)
我对 NoClassDefFoundError 做了一些研究,这意味着 CLASSPATH 设置不正确。但我检查了构建路径,greenDao.jar 在库中。有什么我错过了吗?