0

我的应用程序中有一个预先填充的数据库。运行项目时出现此错误:

06-17 17:15:22.554: ERROR/AndroidRuntime(482): java.lang.AbstractMethodError: abstract method not implemented
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.j256.ormlite.android.AndroidDatabaseConnection.compileStatement(AndroidDatabaseConnection.java)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.j256.ormlite.stmt.mapped.MappedPreparedStmt.compile(MappedPreparedStmt.java:39)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:190)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:134)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.j256.ormlite.stmt.StatementExecutor.queryForAll(StatementExecutor.java:111)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.j256.ormlite.dao.BaseDaoImpl.queryForAll(BaseDaoImpl.java:215)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.tabir.ruya.Ruya.setText(Ruya.java:46)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.tabir.ruya.Ruya.onCreate(Ruya.java:29)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.os.Looper.loop(Looper.java:123)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at android.app.ActivityThread.main(ActivityThread.java:4627)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at java.lang.reflect.Method.invokeNative(Native Method)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at java.lang.reflect.Method.invoke(Method.java:521)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-17 17:15:22.554: ERROR/AndroidRuntime(482):     at dalvik.system.NativeStart.main(Native Method)

这是我使用 Dao 接口查询记录时的代码,

List<SimpleRuya> accountList = simpleRuyaDao.queryForAll();
String ruya=accountList.get(2).getRuya();

Databasehelper旁边我有这个代码

public Dao<SimpleRuya, Integer> getSımpleRuyam() throws SQLException {
    if(simpleRuyaDao==null){
        simpleRuyaDao=getDao(SimpleRuya.class);
    }
    return simpleRuyaDao;
}

是什么导致了这个问题?谢谢。

4

2 回答 2

1

我不确定这里有什么问题,但看起来你的包ormlite-androidormlite-core包之间可能不匹配。

java.lang.AbstractMethodError: abstract method not implemented
    at AndroidDatabaseConnection.compileStatement(AndroidDatabaseConnection.java)

我以前从未见过这条消息。此外,您可以验证 core 和 android jar 是否都在构建路径中。

祝你好运。

于 2011-10-14T15:04:00.663 回答
0

嘿,您使用的是哪个版本的 ormlite?我在使用 ormlite 4.25 时遇到了同样的错误,但它与 ormllite4.20 完美配合

尝试使用 ormlite 2.20

于 2011-09-24T07:06:19.590 回答