【发布时间】:2017-10-24 21:11:45
【问题描述】:
我正在尝试使用 xerial sqlite-jdbc 在 Android 中管理我的数据库,但没有成功。我收到了一个 java.lang.NoClassDefFoundError: org.sqlite.SQLiteConnection 异常。我已将此依赖项 'org.xerial:sqlite-jdbc:3.18.0' 导入我的毕业生。
我的代码如下,
try {
Class.forName("org.sqlite.JDBC");
Connection connection = DriverManager.getConnection("jdbc:sqlite:hs.db");
} catch (ClassNotFoundException eString) {System.err.println("Could not init JDBC driver - driver not found");
} catch (java.sql.SQLException e) {e.printStackTrace();}
在我的项目中使用 android.database.sqlite 不是选项,所以请不要建议作为答案。
【问题讨论】:
-
对该库的官方支持似乎是in this Google Group,基于the documentation。