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

Can't get instance. #188

Closed
AndriyChaban opened this issue May 1, 2023 · 8 comments
Closed

Can't get instance. #188

AndriyChaban opened this issue May 1, 2023 · 8 comments

Comments

@AndriyChaban
Copy link

on the initial Mimir.getInstance command I should provide libembedded_milli.so file. However, can't find it anywhere.
Pretty sure this is not the issue in package. But, unfortunately, cannot solve it by myself. On the readme page no info on that.

@GregoryConrad
Copy link
Owner

@AndriyChaban Are you using Flutter, or Dart-only?

@AndriyChaban
Copy link
Author

I tried both. In flutter the command Mimir.getDefaultInstance throws above mentioned error.
Tried with dart-only all getInstance variants too. Asks the path to that file.

@GregoryConrad
Copy link
Owner

@AndriyChaban If you are using Flutter, you should be using one of the methods mentioned here:

  1. Mimir.defaultInstance for 99.9% of use cases
  2. Mimir.getInstanceForName for when you need another instance for some reason, but in the default location
  3. Mimir.getInstanceForPath for when you need to override the entire path of the database

You should not being using getInstance directly in Flutter.

throws above mentioned error

You didn't really provide any error details (i.e., device, stack trace, etc.); would you mind sharing them please (assuming you used one of the 3 methods listed directly above)?

@AndriyChaban
Copy link
Author

AndriyChaban commented May 1, 2023

At first I tried to get an instance in my local dart package inside Flutter project. Tried all.
Then, as an experiment, tried to get instance with Mimir.defaultInstance inside main.dart.
Got the following:

E/flutter (17760): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libembedded_milli.so': dlopen failed: library "libembedded_milli.so" not found
E/flutter (17760): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/flutter (17760): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
E/flutter (17760): #2 createLibraryImpl (package:flutter_mimir/src/ffi/io.dart:16:27)
E/flutter (17760): #3 FlutterMimirInterface.getInstanceForPath (package:flutter_mimir/src/flutter_interface.dart:35:40)
E/flutter (17760): #4 FlutterMimirInterface.getInstanceForName (package:flutter_mimir/src/flutter_interface.dart:24:14)
E/flutter (17760):
E/flutter (17760): #5 main (package:my_dictionary/main.dart:27:20)
E/flutter (17760):

@GregoryConrad
Copy link
Owner

@AndriyChaban I'm guessing you are using Android/Linux then, in which case the .so file probably failed to download when you were building the project. Delete any build output folders (like build/) and run flutter clean. Even better, if you are using git, something like git clean -xfd would work well (but take a look at what that does before blindly running it!).

Note: until Dart releases "native assets", you will need a semi-decent Internet connection in order to build projects using mimir (and it might take a few minutes to download the necessary binaries). Unfortunately, there is nothing I can do about that at the moment.

@AndriyChaban
Copy link
Author

AndriyChaban commented May 1, 2023

Thank you for prompt replies. Maybe my mobile internet speed does not comply with the requirements of 'semi-decent Internet connection' category...
Will try again later.

@AndriyChaban
Copy link
Author

probably it is Android issue since windows build works well.

@GregoryConrad
Copy link
Owner

Closing this as it is highly likely that you just need to clean your Flutter/Dart build cache for Android and retry (and if you have a flaky Internet connection, it may take a few tries).

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

2 participants