Failed to load dynamic library 'librhttp.so': dlopen failed: library "librhttp.so" not found
Thanks for bringing Rust into Flutter.
I have encountered the following:
rhttp: 0.12.0
Platform: Android
Flutter: 3.24.5
await Rhttp.init(); // in main - yes
build: debug or release
Logs:
Flutter plugin not found, CargoKit plugin will not be applied.
Built ...apk...
E/flutter (20119): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'librhttp.so': dlopen failed: library "librhttp.so" not found
E/flutter (20119): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/flutter (20119): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
E/flutter (20119): #2 new ExternalLibrary.open (package:flutter_rust_bridge/src/platform_types/_io.dart:42:47)
E/flutter (20119): #3 loadExternalLibraryRaw (package:flutter_rust_bridge/src/loader/_io.dart:56:28)
E/flutter (20119): #4 loadExternalLibrary (package:flutter_rust_bridge/src/loader/_io.dart:14:10)
E/flutter (20119): #5 BaseEntrypoint._loadDefaultExternalLibrary (package:flutter_rust_bridge/src/main_components/entrypoint.dart:141:13)
E/flutter (20119): #6 BaseEntrypoint.initImpl (package:flutter_rust_bridge/src/main_components/entrypoint.dart:48:31)
E/flutter (20119): #7 RustLib.init (package:rhttp/src/rust/frb_generated.dart:31:20)
E/flutter (20119): #8 Rhttp.init (package:rhttp/src/rhttp.dart:16:19)
E/flutter (20119): #9 main (package:myapp/main.dart:37:15)
This error happens when await Rhttp.init(); is called.
It happens in debug or release mode.
Previously I was using version 0.9.8 which was working in debug, but not release mode.
I updated the version to try and get it working in release mode.
Further, the message "Flutter plugin not found, CargoKit plugin will not be applied." claims to have been fixed in this version here https://github.com/Tienisto/rhttp/issues/75, but I still get it with v0.12.0
我也遇到了同样的问题 尝试在androidstudio中升级SDK与NDK版本也不行,这是升级后调试的输出信息: Launching lib\main.dart on 21051182C in debug mode... Flutter plugin not found, CargoKit plugin will not be applied.Checking the license for package Android SDK Build-Tools 33.0.1 in E:\android_studio_sdk\licenses License for package Android SDK Build-Tools 33.0.1 accepted. Preparing "Install Android SDK Build-Tools 33.0.1 v.33.0.1". "Install Android SDK Build-Tools 33.0.1 v.33.0.1" ready. Installing Android SDK Build-Tools 33.0.1 in E:\android_studio_sdk\build-tools\33.0.1 "Install Android SDK Build-Tools 33.0.1 v.33.0.1" complete. "Install Android SDK Build-Tools 33.0.1 v.33.0.1" finished. 之后仍抛出异常: ArgumentError (Invalid argument(s): Failed to load dynamic library 'librhttp.so': dlopen failed: library "librhttp.so" not found)
same problem, as a temporary solution, you can put librhttp.so from a previously successfully compiled apk in lib folder
The issue in my project has been resolved. Here are the steps I took, which may be helpful:
I first pulled the latest version of rhttp from GitHub (which should point to 0.12) and replaced the older version. The key fix likely comes from commit c326cde48fdb3a81c723bb33304d31e279008296, as the update in Flutter 3.32 broke the plugin.
However, this wasn't enough, as simply pointing to the new version still resulted in the same error: library "librhttp.so" not found. So, I attempted to manually compile rhttp, encountering many errors related to rustup target, NDK, and NDK toolchain environment variables. After resolving each issue and ensuring the manual compilation succeeded, I set the rhttp version in the original project to 0.12, and everything worked perfectly.
ndk 28 flutter 3.32 msvc
Invalid argument(s): Failed to load dynamic library 'librhttp.so': dlopen failed: library "librhttp.so" not found 我也遇到了这个问题,各位解决了吗
problem seems to be resolved after upgrading flutter version from 3.32.5 to 3.32.8
For me, downgrade rhttp worked: rhttp: 0.11.1 Flutter: 3.27.4
rhttp 0.12.0 and 0.13.0 have the same problem. Maybe the versions after 0.12.0 are only compatible with flutter 3.32.
On the newer Flutter 3.35 - rhttp: 0.13.0 is compatible. Tested on Android