我的应用程序中有一个预先填充的数据库。我运行项目时遇到此错误:
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;
}
是什么导致了这个问题?感谢。
答案 0 :(得分:1)
我不确定这里的问题是什么,但看起来您的ormlite-android
和ormlite-core
软件包之间可能不匹配。
java.lang.AbstractMethodError: abstract method not implemented
at AndroidDatabaseConnection.compileStatement(AndroidDatabaseConnection.java)
我以前从未见过这条消息。此外,您可以验证核心jar和android jar都在构建路径中。
祝你好运。
答案 1 :(得分:0)
尝试使用ormlite 2.20