kira icon indicating copy to clipboard operation
kira copied to clipboard

Fix compilation on android

Open 39george opened this issue 2 years ago • 7 comments
trafficstars

I have managed to launch audio with kira on ios, but on android I got compilation issue:

Screenshot 2023-07-14 at 17 44 43

I figured out that error was caused by oboe crate from cpal deps, which requires shared-stdcxx feature enabled on android build. With this changes kira works on android perfectly :)

39george avatar Jul 14 '23 14:07 39george

Also see #51

which requires shared-stdcxx feature enabled on android build.

Are you saying that there is no other way to use oboe than with the shared libraries? In the linked pr I quote docs that claim something else (but I have no experience there).

NiklasEi avatar Jul 14 '23 17:07 NiklasEi

Hello, I accidentally missed your pr. I have read it, and now I'm not sure if there is no other way. In Bevy the shared-stdcxx feature is required on android, but we can try to set it up in macroquad engine, for testing purposes

39george avatar Jul 14 '23 19:07 39george

I'm watching this thread to see what you all find out. I don't have an Android development environment set up right now.

tesselode avatar Jul 15 '23 23:07 tesselode

I guess https://github.com/rust-mobile/rust-android-examples/tree/main/agdk-oboe shows that oboe can in general be used without the shared-stdcxx feature.

NiklasEi avatar Jul 16 '23 01:07 NiklasEi

I didn't managed how to successfully compile macroquad on android, but I compiled a simple winit app on android, then I added code for playing audio with kira 0.8.4 but I got the same __cxa_pure_virtual error, not on compilation stage, but when launched app and read logcat

Screenshot 2023-07-16 at 14 41 38

Then I switched kira dependency to my local branch with shared-stdcxx fix, and there was no __cxa_pure_virtual error in logcat, but there wasn't sound either. Logcat says that AAudioStream_requestStop(s#1) was called, so I didn't found out the reason why its happening, I have tried to sleep the thread with std::time::thread::sleep(), but it didn't worked, so the reason is not because of AudioManager and StaticSoundData are out of scope. Screenshot 2023-07-16 at 15 04 03

39george avatar Jul 16 '23 12:07 39george

I have just been reading the logcat and found this line:

Screenshot 2023-07-16 at 15 23 35

It says that the audio file wasn't located. I've packed audio file the same way I did in bevy, and it seems that this is the wrong way to pack an audio file to apk in this context. I think that if one'll do it right, it will work with shared-stdcxx enabled.

39george avatar Jul 16 '23 12:07 39george

I can confirm that it only works with shared-stdcxx enabled.

trobanga avatar Jan 03 '24 08:01 trobanga