Android ORMLite 抽象方法未实现错误
我的应用程序中有一个预先填充的数据库。当我运行我的项目时,我收到此错误:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定这里的问题是什么,但看起来您的
ormlite-android
和ormlite-core
包之间可能不匹配。我以前从未见过这条消息。此外,您还可以验证 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
andormlite-core
packages.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.
嘿,您使用的是哪个版本的 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