-
Notifications
You must be signed in to change notification settings - Fork 365
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
Android failed to load dynamic library: dlopen failed: library "libc++shared.so" not found
#900
Comments
You need to find the correct libc++_shared.so for your target in the Android SDK you are using and copy it to jniLibs. |
@trobanga do you know which is the correct one for this case? there are several on my system:
I saw another example of this where somebody included |
Yes, just follow the example and put the lib from |
I solved this problem in my experiment in the past, I don't remember exactly which package was necessary to include, but I know that CPAL uses Jni bridge under the hood because just Oboe in Android don't provide the input and other device specific features. Try to import CPAL with the mentioned features and all of those [android] packages mentioned with their features to see if it solves your problem. I remember that is not necessary include directly a binary inside jni folder because cargo deals with the binaries compilation for you. I will try to find the docs that helped me to solve that issue, but I found diving into CPAL docs and issues. |
I was able to fix it following this advice. Thank you @trobanga. I also had to add this into my android {
// ....
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDirs = ['src/jniLibs']
}
}
} |
Hi all,
I'm trying to run
cpal
on an Android device inside my Flutter application. When I run the app, I am greeted with this error:The project builds fine, but I run this code and then the error is thrown:
I know that this is the same problem as #720 - and I tried this solution from that issue:
no success here. I'm also not entirely sure where exactly to put this code. I tried putting it inside my
build.rs
and also with my main application code as well with no results.I also tried taking issue #563 's advice here:
Doing this created some strange errors. I see that it has usage of
IPHONEOS_DEPLOYMENT_TARGET
which wouldn't make sense for compiling to an android application:However, I'm using
flutter_rust_bridge
which uses a code gen tool that handles most of the compilation for me. I think it automatically compiles for iOS and Android at the same time. I'm not super good at diagnosing configuration errors on Android, so I'm not entirely sure where I could be going wrong here. I also posted this issue on the flutter_rust_bridge github which might provide some more clarity.I've seen people mention dragging a
libc++_shared.so
file into ajniLibs
directory, but neither are present in my project files. I also tried making my own emptyjniLibs
folder to no success either.Long story short, no matter what I seem to try, I can't seem to get rid of this error. Any ideas here?
The text was updated successfully, but these errors were encountered: