-
Notifications
You must be signed in to change notification settings - Fork 309
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
jniLibs
folder missing while trying to solve "libc++_shared.so" not found
errors
#2209
Comments
I am not an expert of cpal, and from the errors you mentioned, it seems to be related to cpal instead of flutter-rust-bridge. My naive guess of "jniLibs folder missing" is to create an empty folder.
I think so, maybe try to ask there since it looks like a general "how to compile cpal on android". |
I was able to fix it. My original issue was that I couldn't actually find the I had to make the Next I added this to my sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDirs = ['src/jniLibs']
}
} Finally , based on this, my #[allow(dead_code)]
fn add_lib(name: impl AsRef<str>, _static: bool)
{
#[cfg(not(feature = "test"))]
println!(
"cargo:rustc-link-lib={}{}",
if _static { "static=" } else { "" },
name.as_ref()
);
}
fn main()
{
let target = std::env::var("TARGET").expect("ERR: Could not check the target for the build.");
if target.contains("android") {
add_lib("c++_shared", false);
}
} unfortunately, copying the after these steps, the issue is solved. For extra reference, here is a template repo someone setup with |
Happy to see the cpal compilation problem is fixed! |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue. |
Describe the bug
I've been trying to use the
cpal
crate on Android, but I am getting this error:I know that this error is the same as this previous issue, but I have tried the suggestions in that issue here. That links to a 404 github page, but I was able to find the correct link for it here and add this code to my
build.rs
:this does not fix the error, but it changes it to this:
I searched through the documentation and I followed instructions on solving these kinds of errors here, by replacing the code in
build.rs
to this:I started to follow instructions:
however, I don't have any folder in my project called jniLibs, my
android
folder looks like this:furthermore, the contents of
ANDROID_NDK/toolchains/llvm/prebuilt
just have a folder calleddarwin-x86_64
which has a bunch of random stuff in it.ANDROID_NDK
is~/Library/Android/sdk/ndk/27.0.12.077973/
.I tried these solutions to no success:
Using cpal in a library for android causes an error RustAudio/cpal#720 (comment)
https://discuss.gradle.org/t/jni-libs-missing-in-apk-need-some-help-here/9292
https://stackoverflow.com/questions/46521003/how-to-create-jinlib-folder-to-android-studio?noredirect=1&lq=1.
android example crashes on launch: "dlopen failed: cannot locate symbol __cxa_pure_virtual" RustAudio/cpal#563 (comment) (couldn't do this one either, because my jniLibs folder is missing)
[Bug] using crate
cpal
crashes #1058 (comment)Cannot locate symbol "_ZSt15get_new_handlerv" katyo/oboe-rs#14
[Bug] using crate
cpal
crashes #1058 (comment)would this be something to take up with the
cpal
people instead?Steps to reproduce
Create a new project with
flutter_rust_bridge_codegen create
, addcpal
to cargo, and run this:Logs
Expected behavior
No response
Generated binding code
No response
OS
No response
Version of
flutter_rust_bridge_codegen
No response
Flutter info
No response
Version of
clang++
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: