#android #sqlite
#Android #sqlite
Вопрос:
После обновления моего проекта до Android 10 я получил сбой при открытии базы данных.
Отчет Logcat:
2020-11-16 09:27:52.091 20196-22102 /? E/SQLiteDatabase: не удалось открыть базу данных '/data/user/ 0/bezeq.gala.preprod/databases/bezeqlocator.db'. android.database.sqlite.Исключение SQLiteCantOpenDatabaseException: неизвестная ошибка (код 1294 SQLITE_CANTOPEN_ENOENT[1294]): не удалось открыть базу данных в android.database.sqlite.SQLiteConnection.nativeOpen (собственный метод) в android.database.sqlite.SQLiteConnection.open (SQLiteConnection.java: 300) в android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java: 218) в android.database.sqlite.SQLiteConnectionPool.openConnectionLocked (SQLiteConnectionPool.java: 737) в android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java: 284) в android.database.sqlite.SQLiteConnectionPool.open (SQLiteConnectionPool.java: 251) в android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java: 1386) в android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java: 1331) в android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java: 994) в android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java: 940) в com.bezeq.locator.dao.db.DBHelper.checkDataBase(DBHelper.java: 210) в com.bezeq.locator.dao.db.DBHelper.create(DBHelper.java:154) в com.bezeq.locator.service.services.OnStartService$CreateDbFromFile.doInBackground(OnStartService.java: 113) в com.bezeq.locator.service.services.OnStartService$CreateDbFromFile.doInBackground(OnStartService.java: 101) в android.os.AsyncTask $ 3.вызов(AsyncTask.java:378) в java.util.concurrent.FutureTask.run(FutureTask.java: 266) в android.os.AsyncTask$SerialExecutor $ 1.выполнить(AsyncTask.java:289) в java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1167) в java.util.concurrent.ThreadPoolExecutor $Worker.run(ThreadPoolExecutor.java:641) на java.lang.Thread.run(Thread.java:919)
Код:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "bezeq.gala"
minSdkVersion 24
targetSdkVersion 29
versionCode 71
versionName "15.0.71"
multiDexEnabled true
project.ext.set("archivesBaseName", "bview-" defaultConfig.versionName);
}
dexOptions {
javaMaxHeapSize "4096M"
}
signingConfigs {
release {
keyAlias 'gala'
storeFile file('\\amam\root\oss\BVieW\Keys\gala_signature_key.jks')
keyPassword System.getenv("BviewKeystorePassword")
storePassword System.getenv("BviewKeystorePassword")
}
}
buildTypes {
def PERMISSIONS_SYSTEM_SYMBOL = "PERMISSIONS_SYSTEM_SYMBOL"
def REST_API_URL = "REST_API_URL"
localhost_emulator {
applicationIdSuffix ".dev"
debuggable true
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALD"';
buildConfigField 'String', REST_API_URL, '"http://10.0.2.2:8080/gala"';
manifestPlaceholders = [appName: "BVieW Dev"]
}
localhost_device {
applicationIdSuffix ".dev"
debuggable true
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALD"';
buildConfigField 'String', REST_API_URL, '"http://localhost:5000/gala"';
manifestPlaceholders = [appName: "BVieW Dev"]
}
debug {
applicationIdSuffix ".dev"
debuggable true
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALD"';
buildConfigField 'String', REST_API_URL, '"http://vm-tbvwwebt1.bezeq.com:8180/gala"';
manifestPlaceholders = [appName: "BVieW Dev"]
}
tst { // Build types may not start with 'test'
applicationIdSuffix ".tst"
debuggable false
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALT"';
buildConfigField 'String', REST_API_URL, '"http://vm-tbvwwebt1.bezeq.com:8180/gala"';
manifestPlaceholders = [appName: "BVieW Test"]
}
release {
debuggable false
// minifyEnabled true
signingConfig signingConfigs.release
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALA"';
buildConfigField 'String', REST_API_URL, '"http://bview.bezeq.com/gala"';
manifestPlaceholders = [appName: "BVieW"]
}
preprod {
initWith release
applicationIdSuffix ".preprod"
manifestPlaceholders = [appName: "BVieW PreProd"]
}
}
flavorDimensions "version"
productFlavors {
regular {
dimension "version"
}
skip_login {
dimension "version"
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
}
repositories {
maven { url "https://mint.splunk.com/gradle/" }
maven { url "https://repo.spring.io/release" }
jcenter()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//multidex suppport for android < 5.0
implementation 'androidx.multidex:multidex:2.0.1'
//design stuff
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
//google stuff
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.libraries.places:places-compat:2.2.0'
//mint (crash report amp; statistics)
implementation 'com.splunk.mint:mint:4.0.9'
//spring framework
implementation 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
implementation 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.2'
//sliding panel
implementation 'com.sothree.slidinguppanel:library:3.3.1'
//circle image
implementation 'de.hdodenhof:circleimageview:2.1.0'
//usb serial connection
implementation 'com.github.felHR85:UsbSerial:4.5'
}
Комментарии:
1. Столкнувшись с той же проблемой.. получил ответ @Anat
2. У меня такая же проблема