# FMOD CORE API | Android integration

**URL:** <https://qa.fmod.com/t/fmod-core-api-android-integration/16238>\
**Category:** FMOD Engine\
**Tags:** android, cpp\
**Created:** [September 29, 2020, 5:05pm UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238 "2020-09-29T17:05:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafaelb149](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@Rafaelb149](https://qa.fmod.com/u/Rafaelb149)\
**Post date:** [September 29, 2020, 5:05pm UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/1 "2020-09-29T17:05:11Z")

</div>

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)
```

---

<div class="post-metadata">

**Author:** ![tristanjl](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/tristanjl/32/261_2.png) [@tristanjl](https://qa.fmod.com/u/tristanjl)\
**Post date:** [September 30, 2020, 6:51am UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/2 "2020-09-30T06:51:52Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Rafaelb149](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@Rafaelb149](https://qa.fmod.com/u/Rafaelb149)\
**Post date:** [October 10, 2020, 9:19pm UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/3 "2020-10-10T21:19:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rafaelb149](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@Rafaelb149](https://qa.fmod.com/u/Rafaelb149)\
**Post date:** [October 13, 2020, 7:10am UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/4 "2020-10-13T07:10:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rafaelb149](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@Rafaelb149](https://qa.fmod.com/u/Rafaelb149)\
**Post date:** [October 14, 2020, 10:11am UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/5 "2020-10-14T10:11:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tristanjl](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/tristanjl/32/261_2.png) [@tristanjl](https://qa.fmod.com/u/tristanjl)\
**Post date:** [October 19, 2020, 5:46am UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/6 "2020-10-19T05:46:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rafaelb149](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@Rafaelb149](https://qa.fmod.com/u/Rafaelb149)\
**Post date:** [October 19, 2020, 8:04am UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/7 "2020-10-19T08:04:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tristanjl](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/tristanjl/32/261_2.png) [@tristanjl](https://qa.fmod.com/u/tristanjl)\
**Post date:** [October 26, 2020, 9:29pm UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/8 "2020-10-26T21:29:36Z")

</div>

Issue discussion continued here - [Debug FMOD on Android](https://qa.fmod.com/t/debug-fmod-on-android/16311)

---

<div class="post-metadata">

**Author:** ![CogSimGuy](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cogsimguy/32/1442_2.png) [@CogSimGuy](https://qa.fmod.com/u/CogSimGuy)\
**Post date:** [December 1, 2020, 11:28pm UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/9 "2020-12-01T23:28:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![CogSimGuy](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cogsimguy/32/1442_2.png) [@CogSimGuy](https://qa.fmod.com/u/CogSimGuy)\
**Post date:** [December 2, 2020, 6:14pm UTC](https://qa.fmod.com/t/fmod-core-api-android-integration/16238/10 "2020-12-02T18:14:43Z")

</div>

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.
