Android ORMLite 抽象方法未实现错误

发布于 2024-11-15 17:10:04 字数 3128 浏览 2 评论 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;
}

是什么原因导致此问题?谢谢。

I have a pre populated database in my application. I get this error when I run my project:

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)

Here my code when I query records with Dao interface ,

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

At the Databasehelper side I have this code

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

What causes this problem ? thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

十雾 2024-11-22 17:10:04

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

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

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

祝你好运。

I'm not sure what the problem is here but it looks possibly like you have a mismatch between your ormlite-android and ormlite-core packages.

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

I've never seen this message before. Also, you can verify that both the core and android jars are both in the build path.

Best of luck.

分开我的手 2024-11-22 17:10:04

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

尝试使用 ormllite 2.20

hey which version of ormlite you are using ? I've got the same error while using ormlite 4.25
but its perfectly working with ormllite4.20

Try with ormlite 2.20

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文