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

libwebf.so load failed #66

Closed
1 task done
pba-cra opened this issue Oct 12, 2022 · 3 comments
Closed
1 task done

libwebf.so load failed #66

pba-cra opened this issue Oct 12, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@pba-cra
Copy link
Contributor

pba-cra commented Oct 12, 2022

Affected version

main

No same issues found.

  • Yes, I search all issues but not found.

Steps to Reproduce

Code example

ArgumentError: Invalid argument(s): Failed to load dynamic library 'libwebf.so': dlopen failed: library "libwebf.so" not found
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:20)
#2 WebfDynamicLibrary.ref (package:webf/src/bridge/dynamic_library.dart:40)
#3 _registerPluginByteCode (package:webf/src/bridge/to_native.dart:257)
#4 registerPluginByteCode (package:webf/src/bridge/to_native.dart)

Expected results

can load library

Actual results

some android platform(such as ,vivo/oppo, os 6.0) load libwebf.so error。

@pba-cra pba-cra added the bug Something isn't working label Oct 12, 2022
@pba-cra pba-cra changed the title libWebf.so load failed libwebf.so load failed Oct 12, 2022
@pba-cra
Copy link
Contributor Author

pba-cra commented Oct 12, 2022

The error happen random on andorid platform which is vivo and oppo.

@pba-cra
Copy link
Contributor Author

pba-cra commented Oct 12, 2022

dart ffi have some error
flutter/flutter#73318

@pba-cra
Copy link
Contributor Author

pba-cra commented Oct 12, 2022

developer can use this code to resolve this problem

public final class XLoader implements FlutterPlugin {
  @Override
  public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
    loadLibrary();
  }

  @Override
  public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {}

  private static boolean isLibraryLoaded = false;

  private static void loadLibrary() {
    if (isLibraryLoaded) {
      return;
    }

    // Loads `libX.so`.
    System.loadLibrary("X");
    isLibraryLoaded = true;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant