# Fmod android integration

**URL:** <https://qa.fmod.com/t/fmod-android-integration/16508>\
**Category:** FMOD Engine\
**Created:** [December 2, 2020, 10:42pm UTC](https://qa.fmod.com/t/fmod-android-integration/16508 "2020-12-02T22:42:51Z")\
**Posts on this page:** 7\
**Page:** 1

<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, 10:42pm UTC](https://qa.fmod.com/t/fmod-android-integration/16508/1 "2020-12-02T22:42:51Z")

</div>

I’ve been using FMOD for years in PC builds but now working on an Android Studio application. The project is Native Activity primarily c++ and I’m using the latest Android build release. I’ve followed the set up for the 3D example (using cmake) and have another library working fine using he exact same configuration. I’m targeting arm64-v8a. Unfortunately FMOD will not initialize and I get the following errors:

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.

I’ve been tracing through other similar posts here such as

> [@FMOD CORE API | Android integration](https://qa.fmod.com/t/fmod-core-api-android-integration/16238):
>
> 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 t…

> [@\[FMOD Studio lowlevel api, Android\] system-\>getNumDrivers() failing](https://qa.fmod.com/t/fmod-studio-lowlevel-api-android-system-getnumdrivers-failing/11967):
>
> FMOD Studio version 1.06.05 Android ARM, Lollipop, Samsung Galaxy S5 Running a NativeActivity with a simple class wrapper to call System.loadLibrary(“fmodL”) and invoke org.fmod.FMOD.init() library loads successfully, org.fmod.FMOD.init() succeeds In native code (after library successfully loaded and initialized) FMOD::Debug\_Initialize succeeds FMOD::System\_Create succeeds system-\>getVersion() succeeds system-\>getNumDrivers() returns FMOD\_ERR\_PLUGIN\_MISSING from the error log: I/fmod …

but to no avail. Any and all help would be appreciated.

---

<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:** [December 3, 2020, 3:52am UTC](https://qa.fmod.com/t/fmod-android-integration/16508/2 "2020-12-03T03:52:41Z")

</div>

It looks like you’re missing the Java component of the FMOD setup.  
In our Android specific docs, there is a section on initializing [Java](https://fmod.com/resources/documentation-api?version=2.1&page=platforms-android.html#java) that should help.

---

<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 3, 2020, 4:28am UTC](https://qa.fmod.com/t/fmod-android-integration/16508/3 "2020-12-03T04:28:50Z")

</div>

I’ve included the init(), close() and load library static functions as outlined in this reference but to no avail. The build gradle also references the jar file as per the example.

I’ve looked at the documentation as well as the second forum post I referenced about attaching the current thread as I am initializing from within a native activity but so far no luck. Is there an example of this anywhere I could reference to make sure I’m calling the attach thread correctly?

---

<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:** [December 4, 2020, 5:38am UTC](https://qa.fmod.com/t/fmod-android-integration/16508/4 "2020-12-04T05:38:32Z")

</div>

Hey CogSimGuy,

I’m not quite sure how you are initialising fmod. It’s worth checking any differences between your implementation and MainActivity.java in the examples.

If that doesn’t help, if you could provide your initialisation code we should be able to help further.

---

<div class="post-metadata">

**Author:** ![joshechoes](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joshechoes/32/558_2.png) [@joshechoes](https://qa.fmod.com/u/joshechoes)\
**Post date:** [December 7, 2020, 10:09am UTC](https://qa.fmod.com/t/fmod-android-integration/16508/5 "2020-12-07T10:09:59Z")

</div>

Make sure you are calling `System.loadLibrary("fmod")` (or whatever your wrapper is) in Java/Kotlin before you call `FMOD.init(context)`.

---

<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 7, 2020, 1:56pm UTC](https://qa.fmod.com/t/fmod-android-integration/16508/6 "2020-12-07T13:56:21Z")

</div>

Josh,

I was finally able to sort it out over the weekend. It was a combination of things…Android Studio + gradle + CMake are an ugly combination of subtleties!

Scott

---

<div class="post-metadata">

**Author:** ![joshechoes](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joshechoes/32/558_2.png) [@joshechoes](https://qa.fmod.com/u/joshechoes)\
**Post date:** [December 7, 2020, 2:44pm UTC](https://qa.fmod.com/t/fmod-android-integration/16508/7 "2020-12-07T14:44:02Z")

</div>

Android.mk and Application.mk improves matters somewhat, but it’s definitely not particularly clean! Glad you got it sorted.
