FMOD CORE API | Android integration

Hi

I’ve checked your android studio example, but it doesn’t work for me.
My app is a native app which almost all app was written in c++. Java part used only for lifecycle management and some platform specifics.
I’ve already integrated fmod core API in my iOS app (same base code), and now I just wanted to apply the same code to run on Android.
I linked all shared libraries (Android.mk) to my project as you did (in your example), I’ve no compilation errors, but fails to create system on run time due to internal error.

I tried also to include the jar and link it via java file, but it didn’t help.
(Do I have to link it via Java? even if I don’t have any api call from Java code?)

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE            := fmod
LOCAL_SRC_FILES         := lib/android/$(TARGET_ARCH_ABI)/libfmod$(FMOD_LIB_SUFFIX).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include

include $(PREBUILT_SHARED_LIBRARY)

Hi Rafaelb149,

You will need to ensure that fmod.jar is included correctly, as the fmod implementation relies on being able to call a number of java functions contained within it. If it is unable to call them, it will return FMOD_ERR_INTERNAL. For android initialisation, see:
https://www.fmod.com/resources/documentation-api?version=2.1&page=platforms-android.html#java

You may also want to check api/core/examples/androidstudio/ndkbuild/3d/app/build.gradle to see how fmod.jar is included in our examples.

Thanks for help, I managed to make it work.
But now I’m facing a strange issue. When I stop for debug my app, sound stop working. The channel are not really playing (exceed the max num of channel) although I call to system->update() every frame.
The same source code works well on iOS, so I guess I missed android specific configuration.

I meant, when I continue to run after stop on a breakpoint for a while. App keep working, but sound engine doesn’t

Hi tristanjl,

We must commit our migration to fmod to production, but I’m afraid that we may implement something wrong. Of corse I would like to know how to solve it, but more important if it say that we did something wrong so we will not push it yet.
Waiting for your response.

Thanks,
Rafael

Hi Rafaelb149,

I haven’t been able to consistently reproduce the issue. I also haven’t seen anything similar outside of using the debugger.

We will keep notice of anything similar happening on Android. But short of anything more concrete or consistent, there may be nothing wrong with the change of which you are suspicious.

But you did succeed once, right?
Try to hold on a C++ breakpoint (most of our app is implement in the NDK part)

Issue discussion continued here - Debug FMOD on Android

I’m having a very similar issue only using the cmake variant of the latest API. All builds and load fine and runs but the audio system give ERR_INTERNAL when trying to create. Is there a way to debug this further to see what’s not working correctly?

I’m seeing these two messages:

I/fmod: FMOD_OS_Init : Detected CPU family: 4, features: 0x7F, cores: 8.
E/fmod: FMOD_JNI_GetEnv : JNI_OnLoad has not run, should have occurred during System.LoadLibrary.

This is a lack of familiarity with Android Studio build process, so any help would be appreciated.