Open alexaung opened 2 years ago
There are many flutter packages that use dynamic libraries and ffi dart, many of the creators of those packages forget to implement this (big mistake): https://github.com/simolus3/drift/issues/895 and https://stackoverflow.com/questions/65551415/failed-to-load-dynamic-library-in-flutter-app Where it is specified that the dynamic library should be opened from java (on Android) with: System.loadLibrary(), since with DynamicLibrary.open() you get "library not found" on older devices (SDK<=23). It took me a week to go through this package and get it working as I know very little about native code, here is the fork if it helps: https://github.com/jpolstre/flutter_js
Ok, I will check into that. Thanks @jpolstre for the tip, if you want to send a PR for this I would check it and accept. Thanks in advance
@jpolstre can you please share the fix for this ? Im trying to use this package but with android it does not work..
@jpolstre can you please share the fix for this ? Im trying to use this package but with android it does not work..
The error may be due to the quickjs library not being imported correctly in the flutter_js plugin, you can try adding the dependency to your project in android/app/build.gradle:
dependencies{
....
//add this
implementation "com.github.fast-development.android-js-runtimes:fastdev-jsruntimes-quickjs:0.3.5"
}
And also in android/build.gradle:
allprojects {
repositories {
google()
mavenCentral()
//add this
maven { url 'https://jitpack.io' }
}
This error only occurred on API 23 Samsung S6 device (both real device and emulator)
flutter doctor -v [✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-x64, locale en-GB) • Flutter version 3.0.1 at /Users/aungmyooo/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision fb57da5f94 (3 weeks ago), 2022-05-19 15:50:29 -0700 • Engine revision caaafc5604 • Dart version 2.17.1 • DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/aungmyooo/Library/Android/sdk • Platform android-32, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.42.0
[✓] Connected device (3 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 6.0 (API 23) (emulator) • macOS (desktop) • macos • darwin-x64 • macOS 12.4 21F79 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
[✓] HTTP Host Availability • All required HTTP hosts are available
• No issues found!