Flutter ObjectBox Unit Testing - Failed to load dynamic library 'lib/objectbox.dll' [closed] - flutter

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
This post was edited and submitted for review 6 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I'm building my new Flutter app with objectBox as DB.
When I write a unittest that includes objectBox, at running the test I get following error message:
Failed to load "C:\Dev\flutter_rebuild\test\db_model_test.dart": Invalid argument(s): Failed to load dynamic library 'lib/objectbox.dll': 126

I found this on:
https://opensourcelibs.com/lib/objectbox-dart
It shows how to download an include the "objectbox.dll" to Windows so that the test can run in Android Studio.
Dart standalone programs:
Install the packages pub get
Install objectbox-c system-wide:
macOS/Linux: execute the following command (answer Y when it asks about installing to /usr/lib)
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
macOS: if dart later complains that it cannot find the libobjectbox.dylib you probably have to unsign the dart binary (source: dart issue):
sudo codesign --remove-signature $(which dart)
Windows: use "Git Bash" or similar to execute the following command
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
Then copy the downloaded lib/objectbox.dll to C:\Windows\System32\ (requires admin privileges).
ObjectBox generates code binding code for classes you want stored based using build_runner. After you've defined your persisted entities (see below), run pub run build_runner build or flutter pub run build_runner build.

Related

Flutter Re-run cmake with a different source directory

When I tried to run Flutter app on windows, it gives an error then says Exited Sigterm. or stmh like this.
the error says;
Re-run cmake with a different source directory
cmake files does not match...
etc.
The Steps that helped me to handle this error are;
open your terminal then write following commands
flutter clean
flutter pub get
flutter run
This will remove you build file and re-create it.
Your problem should have solved now.

How do you compile a flutter application?

I'm seeing that I can introduce a compilation error in my dart code but flutter build ios will still successfully run. If I flutter run -d [my-simulator] the compile error will immediately be presented in a red screen on the simulator but I can't currently easily do this in a CI type check.
Is there are cli command I can run to ensure that all of the dart code is free of compile errors?
You can run dart analyze or flutter analyze commands.
More info

Flutter error - Exception: Gradle task assembleDebug failed with exit code -1

I'm working on a Flutter Application Project.
For a few days I have an issue when running my application. To test it, I create another project but issue is still present.
I have this exception : Gradle task assembleDebug failed with exit code -1
Issue part 1
Issue part 2
If someone has already encountered this problem or has any idea how to solve it i am really interested.
Thanks in advance.
----- UPDATE ----
My issue came from antivirus program which removed my sdkmanager.bat.
When I was doing "flutter doctor", the license was always "not accepted" and after the command "flutter doctor --android-licenses" the sdkmanager was not found.
Solution
On Windows :
do the command Windows + R
Search msconfig
Go to Services
Hide Windows Services
And find this famous antivirus
To finish, reinstall sdk tools (I have the sdk command line tools (obsolete))
I hope this will help you.
In flutter you can generate APK using this command inside your app directory:
flutter build apk --split-per-abi
This will generate 3 apks for different architecture
I have run into this issue before. This happened to me because terms and conditions that you must accept. First, go to the terminal and run
flutter doctor
It should then show you that you have not accepted the terms, and ask you if you want to accept them now. Follow the instructions on screen and accept each one, there will be around 7. After that relaunch your IDE and it should run fine now.
To reply to your answer #Landon Stahl, I haven't issue when I order flutter doctor
Before try to run
And after try to run app I have : "Android license status unknown"
after try to run

How to obfuscate Flutter apps ios?

please help me for the steps to obfuscate the code, step by step until it's finished?
and how do I see if my obfuscate code is successful or not.
Previously I tried running this command "flutter build ios --obfuscate --split-debug-info = / / " but an error appears like this: bash: syntax error near unexpected token `newline ', why the error?
The "obfuscate" function will split the debug-info for your Flutter app when building for the respective platform. for e.g., if your preparing to ship the version 2.0.1, then you'll get a folder named "2.0.1" which shall contain the .symbols files.
Now about how to get this done is by using this command flutter build ios --obfuscate --split-debug-info=debug-info
This will create a folder named debug-info in the root directory of your project and if you do have a new directory created in that after running the above command, then it means that the obfuscation was successful.

new flutter project in vscode has error

when i create a new flutter project in vscode it will immediately shows an error in the main.dart file and gives a gradle error when trying to debug.
shown here: main.dart error
"compiler message: lib/main.dart:68:19: Error: Too few positional arguments: 1 required, 0 given."
I've reinstalled dart and flutter plugins. updated the java install.
in debug console i get this:
debug console
added output of flutter doctor -v
enter image description here
I was also facing the same error, but it was always on my test folder.
This is what I did:
On your terminal, make sure you are in your project repository.
Run the flutter pub get command, it worked for me, may be you
should try it too.
Do you possibly have two different versions of the Flutter SDK on your machine? I wonder if one is being used by flutter create and the other for analysis.
If you're sure you only have one, please open an issue on GitHub and attach a log file for me to investigate.