Search code examples
androidsqlitemonoandroid-sqlitegodot

DLLNotFoundException (e_)sqlite3


I'm exporting an Android game from Godot 4.4dev3 with SQLite and having issues getting it to work. It works on desktop. It always results in a DllNotFound error. I am only targetting arm64-v8a on the export. I have tried:

  • Using Microsoft.Data.Sqlite (this gives "System.DllNotFoundException: e_sqlite3").
  • Using SQLitePCLRaw.bundle_e_sqlite3mc (this gives "System.DllNotFoundException: e_sqlite3mc").

In all above cases I have:

  • Checked the APK contains the correct .so in the correct architecture folder (/libs/arm64-v8a).
  • Checked the .so is for that architecture (file reports it is correct).
  • Manually loaded the .so using [DllImport("e_sqlite3")] and dlopen.
  • Manually called ...Batteries_V2.Init().
  • Added READ/WRITE permissions in the Android Manifest.
  • Looped through all the process info for anything containing "sql" (it finds { Name = libsqlite.so, Size = 1343488 } which is unexpected, Godot's one perhaps?).
  • Tried different jniLib directories with the .so file copied in there.
  • Removed and re-added all dependencies.
  • Cleaned and rebuilt numerous times.
  • Checked for anything useful in LogCat (nothing other than the exceptions).

I also tried it on another Android phone, same issue. I can't see why the file is not being loaded/found. I've also:

  • Tried all flavours and combinations of SQLitePCLRaw.
  • Tried specifically using SetProvider(...sqlite3) instead of the default e_sqlite3 (to closer match the name seen in available assemblies).
  • Tried including the SQLite AAR from the SQLite site (continual issues with the Gradle build).
  • Done an ls on the project directory when it's running and I see the PCL DLLs, as expected.

Solution

  • Moved to LiteDB and it works instantly.