-
-
Notifications
You must be signed in to change notification settings - Fork 159
Description
Bug Description
WebFPlugin.java loadLibrary() unconditionally calls System.loadLibrary("quickjs"), but the APK does not contain a separate libquickjs.so. QuickJS appears to be statically linked into libwebf.so as of recent versions.
Impact
UnsatisfiedLinkError extends Error (not Exception), so it escapes GeneratedPluginRegistrant's catch(Exception) blocks. Since GeneratedPluginRegistrant.registerWith() is invoked via reflection, the error wraps into InvocationTargetException, aborting ALL plugin registration — not just WebF, but every Flutter plugin declared after it.
WebF itself continues to work (via FFI/Dart), but all MethodChannel-based plugins registered after WebF in GeneratedPluginRegistrant silently fail.
Reproduction
E GeneratedPluginsRegister: Tried to automatically register plugins with FlutterEngine but could not find or invoke the GeneratedPluginRegistrant.
E GeneratedPluginsRegister: java.lang.reflect.InvocationTargetException
E GeneratedPluginsRegister: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libquickjs.so" not found
E GeneratedPluginsRegister: at com.openwebf.webf.WebFPlugin.loadLibrary(WebFPlugin.java:51)
E GeneratedPluginsRegister: at com.openwebf.webf.WebFPlugin.onAttachedToEngine(WebFPlugin.java:29)
Root Cause
WebFPlugin.java lines 43-53:
private static void loadLibrary() {
if (isLibraryLoaded) return;
System.loadLibrary("webf"); // ✅ libwebf.so exists
System.loadLibrary("quickjs"); // ❌ libquickjs.so does NOT exist in APK
isLibraryLoaded = true;
}APK only contains libwebf.so (QuickJS is statically linked inside it). There is no libquickjs.so.
Suggested Fix
Option A — Remove the stale loadLibrary("quickjs") call:
private static void loadLibrary() {
if (isLibraryLoaded) return;
System.loadLibrary("webf");
isLibraryLoaded = true;
}Option B — Wrap in try-catch to handle both cases:
private static void loadLibrary() {
if (isLibraryLoaded) return;
System.loadLibrary("webf");
try {
System.loadLibrary("quickjs");
} catch (UnsatisfiedLinkError e) {
// QuickJS statically linked into libwebf.so — expected in newer builds
}
isLibraryLoaded = true;
}Environment
- WebF version: 0.24.14
- Flutter: 3.38.7
- Android device: Huawei MNA-AL00 (arm64-v8a)
- Kotlin: 2.2.20