RustAudio / cpal

Cross-platform audio I/O library in pure Rust
Apache License 2.0
2.7k stars 357 forks source link

Basic docs for getting started with setup for Android #859

Open einarpersson opened 8 months ago

einarpersson commented 8 months ago

Hi, I am new here. I am trying to follow the basic example of just listing output devices on Android, but the app just crashes.

I get for example

E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: com.einarpersson.valbo, PID: 3095
E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__gxx_personality_v0" referenced by "/data/app/~~qcP-23GWIC3vxkwLbM3mzQ==/com.einarpersson.valbo-188CU-VgE3-NVzZIvoEWjg==/base.apk!/lib/x86_64/libvalbo_lib.so"...

and also

03-05 14:19:01.218   386   487 D audioserver: FGS Logger Transaction failed
03-05 14:19:01.218   386   487 D audioserver: -129

Anyway, I am trying to find any information on just getting the setup right for Android. Just following the docs in its current state is not enough since it seems that there are other things that has to be done. In the README i see a lot about Windows. Perhaps a similar section on Android? I understand that the android ecosystem is complex, but at least gather some basic info would be valuable to a newcomer.

thanks!

Edit: Note, I am not really posting this issue about the logs above. Perhaps these parts of the log are not even relevant to the error i am having. The issue / request is just some basic info on how to get started on android, regardless of the source of my error. :)

To be even more specific - How should the Cargo.toml typically look like? Do I have to add any other dependencies or configurations to get this to work?

Also: Can this be expected to work on an android emulator?

knma1992 commented 3 months ago

Hey @einarpersson I am looking for the same thing, currently I am working within a flutter project and using the flutter rust bridge which worked perfectly until I tried to use cpal for audio.

I am having the same issue as you. I tried looking at other projects which have used cpal and audio on android.

https://github.com/tGrothmannFluffy/flutter_rust_bridge_template_cpal/tree/main https://github.com/yamadapc/augmented-audio/tree/master/crates/apps/metronome

Let me now if you made any progress.

einarpersson commented 3 months ago

unfortunately no. Have you made any progress?