# Crash on Android (19) when initing FMOD in JNI

**URL:** <https://qa.fmod.com/t/crash-on-android-19-when-initing-fmod-in-jni/11339>\
**Category:** FMOD Studio\
**Created:** [March 14, 2014, 9:02pm UTC](https://qa.fmod.com/t/crash-on-android-19-when-initing-fmod-in-jni/11339 "2014-03-14T21:02:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cgripeos](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@cgripeos](https://qa.fmod.com/u/cgripeos)\
**Post date:** [March 14, 2014, 9:02pm UTC](https://qa.fmod.com/t/crash-on-android-19-when-initing-fmod-in-jni/11339/1 "2014-03-14T21:02:25Z")

</div>

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:

```auto
   // 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

---

<div class="post-metadata">

**Author:** ![cgripeos](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@cgripeos](https://qa.fmod.com/u/cgripeos)\
**Post date:** [March 27, 2014, 3:19pm UTC](https://qa.fmod.com/t/crash-on-android-19-when-initing-fmod-in-jni/11339/2 "2014-03-27T15:19:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [March 17, 2014, 5:47am UTC](https://qa.fmod.com/t/crash-on-android-19-when-initing-fmod-in-jni/11339/3 "2014-03-17T05:47:05Z")

</div>

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?
