-
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
Using cpal in a library for android causes an error #720
Comments
Can you provide the output of |
Sure!
|
i still don't understand the bug but since it has something to do with the oboe "java-interface" feature it is not a direct cpal problem |
I'm using this code to initialize the context. Just make it part of your fancy lib. use jni::{JNIEnv, JavaVM};
use std::ffi::c_void;
#[no_mangle]
pub extern "C" fn JNI_OnLoad(vm: jni::JavaVM, res: *mut std::os::raw::c_void) -> jni::sys::jint {
let env = vm.get_env().unwrap();
let vm = vm.get_java_vm_pointer() as *mut c_void;
unsafe {
ndk_context::initialize_android_context(vm, res);
}
jni::JNIVersion::V6.into()
} |
Thanks @trobanga 🙏 that was the missing piece 🤩 |
It seems the argument |
I have the same issue. Have you found the solution? very very thanks |
Unfortunately, I haven't found a solution to the issue either. |
Hi all,
I have a Rust library and use it on Android via jni. I load my library into the JVM context as usual.
So far so good.
But as soon as I use cpal (e.g.
cpal::default_host();
) and cross compile it to android, the app crashes when loading my library with the error:java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__gxx_personality_v0" referenced by
Is this an indication that the oboe library is missing? Should I add this library separately? How?
Edit:
Found issue #563 - look similar. After adding c++_shared I get the error when calling cpal:
panicked at 'android context was not initialized': /Users/XXX/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/ndk-context-0.1.1/src/lib.rs:72
I am confused - there is a local path during runtime? 😅
The text was updated successfully, but these errors were encountered: