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

java.lang.UnsatisfiedLinkError: dlopen failed: library "libwebf.so" not found #384

Open
1 task done
charles0122 opened this issue Jun 9, 2023 · 4 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@charles0122
Copy link

Affected version

0.14.0

No same issues found.

  • Yes, I search all issues but not found.

Steps to Reproduce

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...
E/AndroidRuntime(23380): FATAL EXCEPTION: main
E/AndroidRuntime(23380): Process: top.arce.game.app, PID: 23380
E/AndroidRuntime(23380): java.lang.UnsatisfiedLinkError: dlopen failed: library "libwebf.so" not found
E/AndroidRuntime(23380): at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
E/AndroidRuntime(23380): at java.lang.Runtime.loadLibrary0(Runtime.java:998)
E/AndroidRuntime(23380): at java.lang.System.loadLibrary(System.java:1656)
E/AndroidRuntime(23380): at com.openwebf.webf.WebFPlugin.loadLibrary(WebFPlugin.java:64)
E/AndroidRuntime(23380): at com.openwebf.webf.WebFPlugin.onAttachedToEngine(WebFPlugin.java:44)
E/AndroidRuntime(23380): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.add(FlutterEngineConnectionRegistry.java:144)
E/AndroidRuntime(23380): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:124)
E/AndroidRuntime(23380): at top.arce.game.app.MainActivity.configureFlutterEngine(MainActivity.kt:27)
E/AndroidRuntime(23380): at io.flutter.embedding.android.FlutterFragment.configureFlutterEngine(FlutterFragment.java:1245)
E/AndroidRuntime(23380): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:206)
E/AndroidRuntime(23380): at io.flutter.embedding.android.FlutterFragment.onAttach(FlutterFragment.java:789)
E/AndroidRuntime(23380): at androidx.fragment.app.Fragment.performAttach(Fragment.java:3063)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentStateManager.attach(FragmentStateManager.java:464)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:254)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1817)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2985)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2895)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:263)
E/AndroidRuntime(23380): at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:351)
E/AndroidRuntime(23380): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1455)
E/AndroidRuntime(23380): at android.app.Activity.performStart(Activity.java:8076)
E/AndroidRuntime(23380): at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3660)
E/AndroidRuntime(23380): at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
E/AndroidRuntime(23380): at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
E/AndroidRuntime(23380): at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
E/AndroidRuntime(23380): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
E/AndroidRuntime(23380): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
E/AndroidRuntime(23380): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(23380): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(23380): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(23380): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/AndroidRuntime(23380): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(23380): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(23380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Error connecting to the service protocol: failed to connect to http://127.0.0.1:61770/FTjYKJqRO4w=/

Code example

import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'webf_logic.dart';

import 'package:webf/webf.dart';
import 'package:webf/devtools.dart';
import 'package:webf_websocket/webf_websocket.dart';

class WebfPage extends StatelessWidget {
const WebfPage({Key? key}) : super(key: key);

@OverRide
Widget build(BuildContext context) {
final logic = Get.find();
final state = Get.find().state;

return Scaffold(
  appBar: AppBar(
    title: Text("WebF Browser"),
  ),
  body: MyBrowser(),
);

}
}

class MyBrowser extends StatefulWidget {
MyBrowser({Key? key, this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String? title;

@OverRide
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State {
OutlineInputBorder outlineBorder = OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent, width: 0.0),
borderRadius: const BorderRadius.all(
Radius.circular(20.0),
),
);

@OverRide
Widget build(BuildContext context) {
final MediaQueryData queryData = MediaQuery.of(context);
final TextEditingController textEditingController = TextEditingController();

WebF? _kraken;
AppBar appBar = AppBar(
  backgroundColor: Colors.black87,
  titleSpacing: 10.0,
  title: Container(
    height: 40.0,
    child: TextField(
      controller: textEditingController,
      onSubmitted: (value) {
        textEditingController.text = value;
        _kraken?.load(WebFBundle.fromUrl(value));
      },
      decoration: InputDecoration(
        hintText: 'Enter URL',
        hintStyle: TextStyle(color: Colors.black54, fontSize: 16.0),
        contentPadding: const EdgeInsets.all(10.0),
        filled: true,
        fillColor: Colors.grey,
        border: outlineBorder,
        focusedBorder: outlineBorder,
        enabledBorder: outlineBorder,
      ),
      style: TextStyle(color: Colors.black, fontSize: 16.0),
    ),
  ),
  // Here we take the value from the MyHomePage object that was created by
  // the App.build method, and use it to set our appbar title.
);

final Size viewportSize = queryData.size;
return Scaffold(
    appBar: appBar,
    body: Center(
      // Center is a layout widget. It takes a single child and positions it
      // in the middle of the parent.
      child: Column(
        children: [
          _kraken = WebF(
            devToolsService: ChromeDevToolsService(),
            viewportWidth:
                viewportSize.width - queryData.padding.horizontal,
            viewportHeight: viewportSize.height -
                appBar.preferredSize.height -
                queryData.padding.vertical,
            bundle: WebFBundle.fromUrl('assets:assets/bundle.html'),
          ),
        ],
      ),
    ));

}
}

Expected results

normal start

Actual results

failed

@charles0122 charles0122 added the bug Something isn't working label Jun 9, 2023
@charles0122
Copy link
Author

At the beginning, it could run normally, but after operating for a period of time, a bug appeared. I switched to the Api28 Android device and was able to use it normally, but an error was reported that the device was using Api31

@charles0122
Copy link
Author

If this is my reason, please let me know and I will close this issue or you can also

@andycall
Copy link
Member

If you are using the source code from this repo, you need to follow the contributor guide to compile libwebf.so.

https://github.com/openwebf/webf/blob/main/.github/CONTRIBUTING.md

Or use the package published on pub.dev which already includes pre-built libwebf.so libraries.

@charles0122
Copy link
Author

I am already use the package ! dependencies detail :

dependencies:
  webf: ^0.14.0
  webf_websocket: ^1.2.0

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

2 participants