Use Android SQLite support library

pull/146/head
M66B 6 years ago
parent 2f93775420
commit 324b516aa0

@ -84,9 +84,6 @@ FairEmail requires at least Android 6 Marshmallow.
FairEmail will work properly on devices without any Google service installed.
FairEmail might occasionally crash on Motorola/Lenovo devices with Android 7 Nougat or earlier
because of a [bug in Android](https://issuetracker.google.com/issues/63377371).
## Support / frequently asked questions
See [here](https://github.com/M66B/open-source-email/blob/master/FAQ.md) for a list of often asked questions and about how to get support.
@ -125,6 +122,7 @@ FairEmail uses:
* [colorpicker](https://android.googlesource.com/platform/frameworks/opt/colorpicker). Copyright (C) 2013 The Android Open Source Project. [Apache license](https://android.googlesource.com/platform/frameworks/opt/colorpicker/+/master/src/com/android/colorpicker/ColorPickerDialog.java).
* [dnsjava](http://www.xbill.org/dnsjava/). Copyright (c) 1998-2011, Brian Wellington. [BSD License](https://sourceforge.net/p/dnsjava/code/HEAD/tree/trunk/LICENSE).
* [OpenPGP API library](https://github.com/open-keychain/openpgp-api). Copyright (C) 2014-2015 Dominik Schürmann. [Apache License 2.0](https://github.com/open-keychain/openpgp-api/blob/master/LICENSE).
* [Android SQLite support library](https://github.com/requery/sqlite-android). Copyright (C) 2017 requery.io. [Apache License 2.0](https://github.com/requery/sqlite-android/blob/master/LICENSE).
* [App shortcut icon generator](https://romannurik.github.io/AndroidAssetStudio/icons-app-shortcut.html). Copyright ???. [Apache License 2.0](https://github.com/romannurik/AndroidAssetStudio/blob/master/LICENSE).
## License

@ -38,6 +38,11 @@ android {
packagingOptions {
pickFirst 'META-INF/LICENSE.txt'
// keep lib/armeabi-v7a/libsqlite3x.so
exclude 'lib/arm64-v8a/libsqlite3x.so'
// keep lib/x86/libsqlite3x.so
exclude 'lib/x86_64/libsqlite3x.so'
}
}
@ -85,6 +90,7 @@ dependencies {
def jcharset_version = "2.0"
def dnsjava_version = "2.1.8"
def openpgp_version = "12.0"
def requery_version = "3.25.3"
implementation "androidx.appcompat:appcompat:$androidx_version"
implementation "androidx.recyclerview:recyclerview:$androidx_version"
@ -117,6 +123,9 @@ dependencies {
// https://github.com/open-keychain/openpgp-api
implementation "org.sufficientlysecure:openpgp-api:$openpgp_version"
// https://github.com/requery/sqlite-android/
implementation "io.requery:sqlite-android:$requery_version"
// git clone https://android.googlesource.com/platform/frameworks/opt/colorpicker
implementation project(path: ':colorpicker')
}

@ -22,6 +22,7 @@ import androidx.room.TypeConverter;
import androidx.room.TypeConverters;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;
import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
/*
This file is part of FairEmail.
@ -84,6 +85,7 @@ public abstract class DB extends RoomDatabase {
if (sInstance == null) {
sInstance = migrate(Room
.databaseBuilder(context.getApplicationContext(), DB.class, DB_NAME)
.openHelperFactory(new RequerySQLiteOpenHelperFactory())
.setJournalMode(JournalMode.WRITE_AHEAD_LOGGING));
Log.i(Helper.TAG, "sqlite version=" + exec(sInstance, "SELECT sqlite_version() AS sqlite_version"));

Loading…
Cancel
Save