Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load dynamic library 'sqlite3.dll #151

Closed
nikirana22 opened this issue Mar 30, 2023 · 6 comments
Closed

Failed to load dynamic library 'sqlite3.dll #151

nikirana22 opened this issue Mar 30, 2023 · 6 comments

Comments

@nikirana22
Copy link

nikirana22 commented Mar 30, 2023

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'sqlite3.dll': error code 126

#0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
#2      _defaultOpen (package:sqlite3/src/ffi/load_library.dart:81:27)
#3      OpenDynamicLibrary.openSqlite (package:sqlite3/src/ffi/load_library.dart:127:12)
#4      sqlite3 (package:sqlite3/src/ffi/api.dart:15:39)
#5      DbHelper._database (package:time_tracking/utils/db_helper.dart:31:15)
#6      DbHelper.saveData (package:time_tracking/utils/db_helper.dart:47:25)
#7      _TaskScreenState.build.<anonymous closure> (package:time_tracking/screens/task_screen.dart:215:16)
#8      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1096:21)
#9      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:253:24)
#10     TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:627:11)
#11     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:306:5)
#12     BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:239:7)
#13     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:615:9)
#14     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
#15     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
#16     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#17     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
#18     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
#19     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:460:19)
#20     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:440:22)
#21     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:336:11)
#22     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:395:7)
#23     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:357:5)
#24     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:314:7)
#25     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:295:7)
#26     _invoke1 (dart:ui/hooks.dart:164:13)
#27     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:361:7)
#28     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:31)

I'm getting this error while running app on Windows platform . how can i solve this ?
Please correct me if i'm missing something

@simolus3
Copy link
Owner

Did you add sqlite3_flutter_libs to your dependencies?

@mahmoud-haj-ali
Copy link

I have the same issue on Android platform:

Failed to load dynamic library '/data/data/com.mypackage/lib/libsqlite3.so': dlopen failed: library "/data/data/com.mypackage/lib/libsqlite3.so" not found
       at new DynamicLibrary.open(dart:ffi)
       at ._defaultOpen(load_library.dart:40)
       at OpenDynamicLibrary.openSqlite(load_library.dart:127)
       at .sqlite3(api.dart:15)
       at _NativeDelegate.openDatabase(native.dart:155)
       at Sqlite3Delegate._createDatabase(database.dart:73)
       at Sqlite3Delegate.open(database.dart:61)
       at DelegatedDatabase.ensureOpen.<fn>(engines.dart:334)

it's happened when call:

select(table_name).get()

I have catch it from firebase crashlytics on this device:

Brand: Samsung
Model: Galaxy A7(2016)
Version: Android 6.0.1

I'm using latest version of the library sqlite3_flutter_libs: 0.5.13

@simolus3
Copy link
Owner

simolus3 commented Apr 1, 2023

Version: Android 6.0.1

Old Android versions are weird when loading native libraries, did you explore these workarounds already?

That still doesn't explain the issue for Windows, are there any build errors that could be related to sqlite3? The sqlite3_flutter_libs package should provide a build script for Windows as well.

@keith555
Copy link

I'm getting the same issue on Windows 11, running the demo app from pub.dev.

Unhandled exception:
Invalid argument(s): Failed to load dynamic library 'sqlite3.dll': error code 126
#0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
#2      _defaultOpen
#3      OpenDynamicLibrary.openSqlite
#4      sqlite3
#5      main
#6      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#7      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)

Exited (255)

@keith555
Copy link

I can get it working by downloading a copy of sqlite3.dll into a directory and adding it to the Windows path variable.

@simolus3
Copy link
Owner

Yes, this is intentional.

running the demo app from pub.dev.

Yeah unfortunately we can't add more information to pub.dev, the example is a simple Dart script and not an app that could run without external dependencies. I'll add a note to that file to explain that the native library is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants