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 #48

Closed
Aljabri-Salman opened this issue Apr 3, 2021 · 30 comments
Closed

Failed to load dynamic library #48

Aljabri-Salman opened this issue Apr 3, 2021 · 30 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Aljabri-Salman
Copy link

Hi,
unable to load the library on windows. I am getting:

flutter: Invalid argument(s): Failed to load dynamic library (126)
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: IsarError: Could not initialize IsarCore library. If you create a Flutter app, make sure to add isar_flutter_libs to your dependencies. Isar does not support 32-bit processors so make sure that your device / emulator has a 64-bit processor.
#0      initializeIsarCore
package:isar/…/native/isar_core.dart:56
#1      openIsar
package:isardb/isar.g.dart:39

Version

  • Platform: Android, Windows 64 bit,
  • Flutter version: [2.0.4]
  • Isar version: [0.2.0]
  • Isar flutter lib version: [0.2.0]
  • Isar Generator version: [0.2.0]

Should I download the library manually? if yes what path should it be on windows.

@simc
Copy link
Member

simc commented Apr 3, 2021

@Aljabri-Salman On which device does this error happen?

@Aljabri-Salman
Copy link
Author

last device I tried was Windows but I had the same error on Android emulator

@simc
Copy link
Member

simc commented Apr 3, 2021

@Aljabri-Salman

Desktop binaries are not included by default yet. You can include them yourself.

Did you use an x86 or x64 Android emulator? Isar only supports 64bit devices.

@Aljabri-Salman
Copy link
Author

@leisim I am using LDplayer 64 bit as android emulator. I just tried it on a real android device and it seems to work fine.
could you tell me how to add the binaries to windows. I downloaded this file

https://github.com/isar/isar-core/releases/download/0.1.9/isar_windows_x64.dll

But have no idea where it should be.

@simc
Copy link
Member

simc commented Apr 4, 2021

@Aljabri-Salman I think you need to distribute the dll in the same directory as your windows executable. I'll provide detailed documentation in a few days.

@simc simc added the documentation Improvements or additions to documentation label Apr 4, 2021
@barbalex
Copy link

barbalex commented Apr 13, 2021

I am getting a similar error on Android emulator and a different one when using Chrome:

Android emulator (Pixel 3):

Launching lib\main.dart on sdk gphone x86 arm in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:61119/AhnwTLmotlA=/ws
[GETX] Instance "AuthController" has been created
[GETX] Instance "AuthController" has been initialized
I/flutter ( 5266): Invalid argument(s): Failed to load dynamic library 'libisar.so': dlopen failed: library "libisar.so" not found

And a popup tells me:

IsarError (IsarError: Could not initialize IsarCore library. If you create a Flutter app, make sure to add isar_flutter_libs to your dependencies. Isar does not support 32-bit processors so make sure that your device / emulator has a 64-bit processor.)

Chrome:

Launching lib\main.dart on Chrome in debug mode...
lib\main.dart:1
lib/isar.g.dart:3:8: Error: Not found: 'dart:ffi'
import 'dart:ffi';
       ^

../flutter/.pub-cache/hosted/pub.dartlang.org/isar-0.4.0/lib/src/isar_native.dart:6:8: Error: Not found: 'dart:ffi'
import 'dart:ffi';

(plus hundreds of similar lines)

Maybe importing dart:ffi on the web is not possible? flutter/flutter#43898 (comment)

Version

  • Platform: Android Emulator/Chrome on Windows 10 64 bit
  • Flutter version: [2.1.0]
  • Isar version: [0.4.0]
  • Isar flutter lib version: [0.4.0]
  • Isar Generator version: [0.4.0]

@simc
Copy link
Member

simc commented Apr 13, 2021

@barbalex The error message already mentions the problem: You try to run Isar on a 32 bit emulator

Launching lib\main.dart on sdk gphone x86 arm in debug mode

Edit: Web is not supported yet.

@barbalex
Copy link

Being a web dev and new to flutter, I assumed the Pixel 3 Emulator would be 64 bit. How do I choose a 64 bit emulator? (I realize this is not an isar question and will search google for the answer too)

@barbalex
Copy link

In Android Studio it says that the emulator is x86. What am I doing wrong?

@barbalex
Copy link

O.k., so x86 seems to be 32bit. Will have to find out why I can only choose 32bit emulators in android studio...

@simc
Copy link
Member

simc commented Apr 13, 2021

Not sure but I think you should install Intel HAXM and select a recent Android version for the emulator.

@barbalex
Copy link

So it seems that 32 bit is the standard that android studio offers. I had to click a separate tab in the avd manager to be able to choose x86_64 devices. Well, new day, new things learned. Sorry for bugging you @leisim

@simc
Copy link
Member

simc commented Apr 13, 2021

@barbalex No worries, let me know if I can help with anything else :)

@derolf
Copy link

derolf commented Apr 20, 2021

@leisim

Desktop binaries are not included by default yet. You can include them yourself.

How can I include them?

@nghialm269
Copy link

@leisim

Isar only supports 64bit devices.

Does this mean isar doesn't work on armeabi-v7a devices? Is there any reason for this limitation?

@simc
Copy link
Member

simc commented Apr 23, 2021

@nghialm269 Yes unfortunately armeabi-v7a devices are not supported. The reason is that very few devices are still 32bit and not supporting them makes testing, building and distributing Isar easier.

@EslamAbotaleb
Copy link

EslamAbotaleb commented Jun 28, 2021

@leisim There devices support 64bit procoessor , i test on Samsung A10, and Xiaomi redmi 6 specific on bluestacks & real device , and the problem still found , not only 32bit problem appear !

@simc
Copy link
Member

simc commented Dec 31, 2021

Fixed with stable release

@simc simc closed this as completed Dec 31, 2021
@barbalex
Copy link

So it seems that 32 bit is the standard that android studio offers. I had to click a separate tab in the avd manager to be able to choose x86_64 devices. Well, new day, new things learned. Sorry for bugging you @leisim

This caught me again, using a new notebook. I do feel that explicitely mentioning this in the quickstart might help some other devs too. It really hits me hard that 32bit is the standard android studio creates.

Thanks for this really great project. It is so great that I miss it when creating pure web projects...

@simc
Copy link
Member

simc commented Feb 19, 2022

@barbalex With "pure web" do you mean Flutter web or normal web projects? Because Isar supports Flutter web now :)

@barbalex
Copy link

I am a web dev. Most of my projects use JavaScript and react. My last web project is offline-capable and deals very nicely with conflicts. I am actually rather proud of it.

Unfortunately offline-capable is not something Apple allows web-apps to be. They limit offline storage to 5 MB. And a lot of the users (here in Switzerland) of my app use iPhones 😢

Which is why I am now building an app with flutter.

I do like flutter a lot. But being a seasoned web dev the only thing I really miss in web tech from my flutter adventure is isar. The tool that comes closest is WatermelonDB: https://github.com/Nozbe/WatermelonDB.

Loved finding that isar works in web now too ❤️

@simc
Copy link
Member

simc commented Feb 19, 2022

That might be true for localstorage but certainly not for IndexedDB (what Isar uses). Afaik iOS allows at least 500mb of IndexedDB storage.

WatermelonDB also uses IndexedDB

@barbalex
Copy link

Hm. You are right. I guess I will have to dig deeper. There certainly is something preventing my app from running on iOS but as I do not have iOS devices myself I have not been able to look at it closely.

I may have given up a bit prematurely because I have run into so many issues on iOS with other apps too. iOS/Safari truly seems to be the new Internet Explorer 😭

@simc
Copy link
Member

simc commented Feb 19, 2022

I just tried it on an iPhone 13 and you can store 1GB without issues and then you get a prompt for every 200MB increase asking whether you want to allow it 🙂

https://demo.agektmr.com/storage/

Edit: LocalStorage has a 5MB limit on my device but that's a good thing imo haha

@devr0306
Copy link

devr0306 commented Mar 10, 2022

Desktop binaries are not included by default yet. You can include them yourself.

How do we include them?

@holdenhinkle
Copy link

holdenhinkle commented May 22, 2022

@leisim

Desktop binaries are not included by default yet. You can include them yourself.

How can I include them?

Yes, can you please tell us how to include them?

If I can get this working on a Mac for a MacOs app, I'd be happy to help with updating documentation if you want. It seems at a least a few people could benefit from that.

Thanks.

@simc
Copy link
Member

simc commented May 22, 2022

@holdenhinkle I answered in the Telegram group. This issue is outdated. The binaries are included now by default

@Lucksmith369
Copy link

issue is still present, trying on a rk3288 Board

@alabiboo
Copy link

The issue for me is that Isar works on Android 12 device but does not work on Android 10. How could I fix this

@md-weber
Copy link

md-weber commented Dec 8, 2022

I have a similar issue with the newest version, but it could be related to my pure dart implementation. I have no isar_flutter_libs included.

Current working OP: Windows 64bit system

I am working myself with the FFI package but I hope that should not lead to any issues.

Invalid argument(s): Failed to load dynamic library '..\window_selector\.dart_tool\pub\bin\window_selector\isar.dll': error code 126
#0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
#2      _initializePath (package:isar/src/native/isar_core.dart:92:28)
#3      initializeCoreBinary (package:isar/src/native/isar_core.dart:75:9)
#4      openIsar (package:isar/src/native/open.dart:81:3)
#5      Isar.open (package:isar/src/isar.dart:107:12)
#6      main (file:///C:/Users/weber/dev/dart_projects/window_selector/bin/window_selector.dart:7:27)
#7      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

pubspec.yaml

name: window_selector
description: A sample command-line application.
version: 1.0.0
# homepage: https://www.example.com

environment:
  sdk: '>=2.18.4 <3.0.0'

dependencies:
  isar: ^3.0.5
  win32: ^3.1.2
dev_dependencies:
  build_runner: ^2.3.2
  isar_generator: ^3.0.5
  lints: ^2.0.0
  test: ^1.16.0

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

No branches or pull requests