Sqldelight: SQLite FTS5 does not work on Android

Created on 24 Sep 2020  路  2Comments  路  Source: cashapp/sqldelight

Runtime Environment

SQLDelight version: 1.4.3
Application OS: Android
minSdkVersion: 23, 24
targetSdkVersion: 29

Description

I'm trying to use the FTS5 SQLite module. Firstly it was tested on iOS and it worked, but when I tried to use it on Android it crashed at runtime.

Stacktrace

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: xxx, PID: 17799
    android.database.sqlite.SQLiteException: no such module: FTS5 (code 1 SQLITE_ERROR[1]): , while compiling:
 **sql query**
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1372)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:811)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:62)
        at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
        at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
        at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1959)
        at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1934)
        at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.query(FrameworkSQLiteDatabase.java:161)
        at com.squareup.sqldelight.android.AndroidQuery.executeQuery(AndroidSqliteDriver.kt:228)
        at com.squareup.sqldelight.android.AndroidQuery.executeQuery(AndroidSqliteDriver.kt:203)
        at com.squareup.sqldelight.android.AndroidSqliteDriver$executeQuery$2.invoke(AndroidSqliteDriver.kt:143)
        at com.squareup.sqldelight.android.AndroidSqliteDriver$executeQuery$2.invoke(AndroidSqliteDriver.kt:19)
        at com.squareup.sqldelight.android.AndroidSqliteDriver.execute(AndroidSqliteDriver.kt:121)
        at com.squareup.sqldelight.android.AndroidSqliteDriver.executeQuery(AndroidSqliteDriver.kt:143)
        ....
bug

Most helpful comment

fts5 is not shipped natively with android, you need to use an unbundled version of sqlite to use it. Prefer fts3 or fts4 for bundled android sqlite

All 2 comments

fts5 is not shipped natively with android, you need to use an unbundled version of sqlite to use it. Prefer fts3 or fts4 for bundled android sqlite

minSdkVersion 24 should also work since that is when FTS5 support was introduced to the framework.

Was this page helpful?
0 / 5 - 0 ratings