android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open dat
来源:互联网 发布:灯光秀编程 编辑:程序博客网 时间:2024/05/21 03:17
今天从晚上下了一份Demo源码,导入到Android Studio运行,报出了如下的错误:
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193) at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177) at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:806) at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:791) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694) at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:709) at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:702) at com.dm.selectcity.DBHelper.createDataBase(DBHelper.java:101) at com.dm.selectcity.MainActivity.getCityList(MainActivity.java:256) at com.dm.selectcity.MainActivity.cityInit(MainActivity.java:208) at com.dm.selectcity.MainActivity.onCreate(MainActivity.java:154) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
在Stack Overflow中查询了相关的问题,有很多同学提出了如下的解决方法:
1. 添加读写权限
2. 修改代码
解决方法有很多,在这里不一一列举,链接如下:
http://stackoverflow.com/questions/17034511/android-database-sqlite-sqlitecantopendatabaseexception-unknown-error-code-14
如上的方法尝试过,都没有解决上述的错误,然后在读Demo里面代码的时候发现了如下问题:
数据库路径与自己工程的报名不一致
在将路径修改为包名后,程序成功运行了!
虽然这是一个小问题,但是反应了程序调试中每个细节都是至关重要的。作为开发者,往往一个小小的忽视会造成大好几个数量级的错误,编写程序需要用心、用细心!
1 0
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open dat
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (Sqlite code 14): Could not o
- Android sqlite unknown error (code 14): Could not open database
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code
- unknown error (Sqlite code 14): Could not open database解决方案
- unknown error (Sqlite code 14): Could not open database, (OS error
- unknown error (code 14): Could not open database
- android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 14)
- android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 14)
- 解决 Android 7.0 SQLiteCantOpenDatabaseException: unknown error (code 14)
- SQLiteCantOpenDatabaseException: unable to open database file (code 14)
- System.err: android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (c
- not an error (code 0): Could not open the database in read/write mode.的解决办法
- SQLiteException: not an error (code 0): Could not open the database in read/write mode
- Error 1402. Could not open key UNKNOWN\Components\ DA42BC89BF25F5BD0AF18C3B9B1A1EE8
- Could not open CRS database
- Caused by: android.database.sqlite.SQLiteDatabaseCorruptException: file is encrypted or is not a dat
- git remote
- GC是什么? 为什么要有GC?
- android webview中调用了js的混淆
- 学习Spark(1)
- LintCode 387. The Smallest Difference
- android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open dat
- nginx 403forbidden
- java web定时任务的实现
- JavaWeb 服务启动时,在后台启动加载一个线程
- ProgressDialog高级使用
- lintcode ----最小子数组
- windows下AGK的配置
- acm 3 1015 十进制转换
- 伪类选择器第一个字变大写