原因:
本人遇到的是因为没有给数据库文件test.db读写的权限,赋权限后即可正常访问
06-14 07:10:27.257: E/SQLiteLog(1316): (14) os_unix.c:30176: (13) open(/data/data/com.example.login/files/test.db) -
06-14 07:10:27.367: E/SQLiteDatabase(1316):
Failed to open database '/data/data/com.example.login/files/test.db'.
06-14 07:10:27.367: E/SQLiteDatabase(1316): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:709)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at com.example.login.LoginActivity.onCreate(LoginActivity.java:33)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.app.Activity.performCreate(Activity.java:5104)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.os.Handler.dispatchMessage(Handler.java:99)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.os.Looper.loop(Looper.java:137)
06-14 07:10:27.367: E/SQLiteDatabase(1316): at android.app.ActivityThread.main(ActivityThread.java:5039)