Hi everyone,

I am working on integrating FMOD Studio with my Cocos2dx cross-platform game (iOS and Android). Everything works perfectly in iOS, but in the Android project I’m running into some problems.

I’ve edited the jni/ file to find the fmod .so files (this took a while to figure out) and it compiles fine using the cocos compile command. However, when I run the project using Android Studio I get a runtime error “Fatal Signal 11” at the line system->initialize.

I searched for solutions and found that it may have something to do with the fmod.jar file, but I can’t figure out how to include this file in the project. Does Cocos2d-x have any .java files, .mk files, or other configuration files that need to be edited to connect this file to the project?

Has anyone gotten FMOD to work with Cocos2d-x on Android before? If so, what am I missing? There doesn’t seem to be much information available.


  • Mathew Block

    Can you try linking with the logging version of FMOD? This should give some information about what is going wrong in LogCat.

    You are correct about the fmod.jar, it is required. I would recommend consulting the Cocos documentation on how to add Java dependencies to the project.

  • Nick Vowell

    Thanks, that pointed me in the right direction and I was able to get it working. The missing fmod.jar file was causing the runtime error.

  • You must to post comments
Best Answer

The solution was to include the missing fmod.jar file in the project.

FMOD uses many Java only APIs to operate, it does so by calling from native code out to Java via JNI. If the fmod.jar file isn’t present we are unable to call these necessary Java only APIs.

  • You must to post comments

I think I have the same problem as described here. But I can’t find a way to properly add the fmod.jar to the project. Here is my file, which seems to ignore the fmod.jar inclusion:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
include $(BUILD_PACKAGE)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := fmodJar:../../../fmodLib/android/fmod.jar

include $(CLEAR_VARS)
LOCAL_MODULE := libfmodL
LOCAL_SRC_FILES := ../../../fmodLib/android/debug/

include $(CLEAR_VARS)
LOCAL_MODULE := libfmodstudioL
LOCAL_SRC_FILES := ../../../fmodLib/android/debug/

include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp \
               ../../../Classes/AppDelegate.cpp \
               ../../../Classes/HelloWorldScene.cpp \
               ../../../Classes/FMODAudioEngine_android.cpp \

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes \
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../fmodClasses/inc_android/lowlevel \
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../fmodClasses/inc_android/studio \

LOCAL_STATIC_LIBRARIES := cocos2dx_static 



$(call import-module,.)

I get this error in Android Studio:

02-16 11:10:43.391 26858-26886/com.mycompany.myapp E/fmod: FMOD_JNI_GetEnv                          
: JNI_OnLoad has not run, should have occurred during System.LoadLibrary.
02-16 11:10:43.401 26858-26886/com.mycompany.myapp E/fmod: FMOD_JNI_GetEnv : 
JNI_OnLoad has not run, should have occurred during System.LoadLibrary.

02-16 11:10:43.401 26858-26886/com.mycompany.myapp A/libc: 
FMOD::Studio::System* FMODAudioEngine::getStudioSystem(): assertion "result == FMOD_OK" failed
02-16 11:10:43.401 26858-26886/com.mycompany.myapp A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 26886 (GLThread 9359)
  • Stian Remvik

    This is the command I use in Terminal to build: cocos compile –android-studio –target android-22 –ap android-22 –ndk-mode debug –ndk-toolchain arm-linux-androideabi-4.9 –platform android –app-abi armeabi

  • Stian Remvik

    I guess I have to add the fmod.jar file to the Android Studio project, not in I have it in folder. Right-clicked the file and selected “Add as library”. In “build.gradle” (Module: MyProject) its listed under dependencies: compile files(‘libs/fmod.jar’). Still same “Fatal signal 6” error.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.