Skip to content

Using cpal in a library for android causes an error #720

@Flocksserver

Description

@Flocksserver

Hi all,
I have a Rust library and use it on Android via jni. I load my library into the JVM context as usual.

companion object {
        init {
            System.loadLibrary("myfancylib")
        }
    }

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.com-1ecc6299db9ec823/ndk-context-0.1.1/src/lib.rs:72

I am confused - there is a local path during runtime? 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions