KSP Room processor fails on CI machine

464 views Asked by At

I've migrated Room kapt to ksp. Everything works fine on the local machine (Mac), but on our Linux CI machine I'm getting an error, and the app does not compile. Any ideas, why it might happen and how to fix it?

Stacktrace:

Task :app:kspCustomQaKotlin

e: java.lang.ExceptionInInitializerError

at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:82)

...

Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=x86_64, paths=[/org/sqlite/native/Linux/x86_64:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]

at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:389)

at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:68)

at androidx.room.verifier.DatabaseVerifier.<clinit>(DatabaseVerifier.kt:70)
1

There are 1 answers

2
Nikola Despotoski On

DatabaseVerifier is part of the room compiler and it uses local SQLite instance to verify the correctness of the SQLite queries. It does the verification by executing the queries on a in memory instance of SQLite on the machine. This is not related to the KSP itself.

Cause of the error

Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=x86_64, paths=[/org/sqlite/native/Linux/x86_64:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]

says that it is unable to find sqlite binary on your machine. Have you tried installing it manually? You can also write small gradle task that checks for sqlite binary when running on your CI.