Search code examples
fluttersqlitesqflite

Error when using sqflite_common_ffi instead of sqfilte on Android


For targeting mulitple platforms, I want to use sqflite_common_ffi instead of sqflite (sqflite_common_ffi is compatible with Windows).

But when I run my project on Android, I have this exception when runningdatabaseFactoryFfi.openDatabase method:

Invalid argument(s): Failed to load dynamic library '/data/data/com.coutier.scool/lib/libsqlite3.so': dlopen failed: library "/data/data/com.coutier.scool/lib/libsqlite3.so" not found

I do not understand : sqlite not supposed to be included in android ? Why this package want to load a specific library ?

If I really need this library to make sqflite_common_ffi run, where can I find this library and where have I to put in my project tree ?


Solution

  • On iOS and Android, you can add sqlite3_flutter_libs that includes the binaries for iOS and Android. sqflite_common_ffi uses sqlite3 and its default library loader should work as is.