1

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 Answers1

0

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.

Nikola Despotoski
  • 49,966
  • 15
  • 119
  • 148
  • Installing SQLite manually might indeed be a solution. It doesn't explain why the same CI machine builds the app without problems when using kapt though. – Artem Kleinschmidt Jun 08 '22 at 07:36
  • You may want to ensure android sdk directory is in the PATH, sqlite is also part of the platform tools. I could be that as well. – Nikola Despotoski Jun 08 '22 at 10:17