Crash on Android (19) when initing FMOD in JNI

Hi,

I just started Android and fmod development.

I have fmod initializing and playing sounds fine on a Windows7 platform.

On Android, I’ve created a simple test where I have an Java app calling out to my own *.so (jni) lib that I’ve created. (I’m compiling using the Android API level 14).

So far things work fine.

My jni *so lib then goes on to initialize fmod and it crashes inside the FMod::Studio::System::initialize() call.

I’m running my test on the Android Emulator:

CPU/ABI: ARM (Armabi-v7a)
Target: Android 4.4 (API Level 19)
RAM: 343
VM Heap: 32
Skin: 480x800
hm.dPad: no
hw.lcd.density: 240
avd.ini.encoding: ISO-8859-1
hw.device.hash: 499058361
hx.camera.back: none
disk.dataPartition.size: 200M
hw.gpu.enabled: yes
skin.dynamic: yes

Using the debug fmod and studio libs, my LogCat output is:

03-14 16:42:30.431: I/fmod(1369): FMOD: SystemI::init : FMOD Studio Version: 00010300 (51513)
03-14 16:42:30.431: I/fmod(1369): FMOD: SystemI::init : maxchannels = 1, flags = 00000004, extradriverdata = 0x0
03-14 16:42:30.431: I/fmod(1369): FMOD: SystemI::close :
03-14 16:42:30.431: I/fmod(1369): FMOD: SystemI::close : Stop all sounds
03-14 16:42:30.431: I/fmod(1369): FMOD: SystemI::close : Remove miscllaneous DSP stuff.
03-14 16:42:30.431: I/fmod(1369): FMOD: SystemI::close : done.
03-14 16:42:30.441: I/fmod(1369): FMOD: FMOD_OS_Init : Detected Neon instruction support, will use Neon optimized mixing and resampling.
03-14 16:42:30.441: I/fmod(1369): FMOD: SystemI::init : Set up software engine
03-14 16:42:30.451: I/fmod(1369): FMOD: OutputOpenSL::init : Initializing…
03-14 16:42:30.451: I/fmod(1369): FMOD: OutputOpenSL::init : Only mono and stereo supported, defaulting to stereo.
03-14 16:42:30.461: I/fmod(1369): FMOD: OutputOpenSL::init : Done.
03-14 16:42:30.471: I/fmod(1369): FMOD: OutputOpenSL::start : Starting…
03-14 16:42:30.481: I/fmod(1369): FMOD: OutputOpenSL::start : Done.
03-14 16:42:30.481: I/fmod(1369): FMOD: OutputPolled::start : Starting thread that automatically wakes up every 10 ms
03-14 16:42:30.481: I/fmod(1369): FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 3
03-14 16:42:30.481: I/fmod(1369): FMOD: Thread::initThread : - Stacksize 49152. Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
[color=#FF0000]03-14 16:42:30.481: A/libc(1369): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1383 (hmx.test)
[/color]

My fmod initialization code is simple:

   // init fmod system for low-level api
   void* extradriverdata = nullptr;

   // Create a System object and initialize.
   FMOD_FAIL( FMOD::Studio::System::create(&mSystem) );
   FMOD_STUDIO_INITFLAGS studioFlags = FMOD_INIT_NORMAL;

   FMOD_STUDIO_INITFLAGS lowLevelFlags = FMOD_INIT_NORMAL|FMOD_INIT_3D_RIGHTHANDED;
   
   // init!
   FMOD_FAIL( mSystem->initialize(1, studioFlags, lowLevelFlags, extradriverdata) ); // << CRASH on android

   FMOD_FAIL( mSystem->getLowLevelSystem(&mLowLevelSystem) );

Ha sanybody else gotten this problem?
Any help on this would be greatly appreciated!

Thanks!
xris

It turned out to be user error. I’m new to Eclipse.

Using the info you gave me and the sample code that fmod comes with, I was able to track it down to the fmod.jar not being set up properly in my project (fmod.jar was not checked in the “Order and Export” panel in Eclipse)

Thanks again for the help and quick response.

It looks like you are getting a crash when you first start up an FMOD thread.

Is it possible you’re loading the FMOD library in an unusual way (like via C# for instance), we do some setup in JNI_OnLoad that appears to have not occurred.

Are you able to reproduce this crash using our examples?