I am trying to set up FMOD for Android, and have started with the examples provided in the API. I have not managed to set up a working project. However, I have downloaded a working project for Android Studio from here: https://github.com/WillCoder/Fmod-Sample-3d
I can build and run this project. The example implemented is event_parameter.cpp. As a start, I try to compile new .so files for another example using NDK, but I have not managed to get it working. I assume something is wrong with the Android.mk file or the project structure. I have searched for other questions on the topic, and in some answers there are references to examples of Android.mk in the API, but I haven’t found any examples in the lates API (1.08). I have modified the Android.mk from API 1.04:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := simple_event
LOCAL_SRC_FILES := simple_event.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
include $(BUILD_SHARED_LIBRARY)
I get lots of “undefined reference to” errors in simple_event.cpp, e.g. to Common_Init(void**), FMOD::Studio::System::create(FMOD::Studio::System**, unsigned int), etc.
Any ideas about what is wrong? Are there any example of project structures and Android.mk files?
It looks like you are missing the sections that define the FMOD libraries and the linker line to include them. Since we have switched our examples over the NVIDIA Nsight Tegra to allow Visual Studio usage I can see there is a gap in knowledge for working with the NDK toolchain. To help this I have added a section to our Android basic docs, here is a copy of what will be in our next release:
Examples
For simplicity all FMOD examples make use of the NVIDIA Nsight Tegra integration with Visual Studio.
To link FMOD into your native code using the NDK tool chain you can use the below Android.mk and Application.mk files as a guide.
This example assumes the two make files are placed in [FMOD SDK DIR]/api/studio/examples, that ndk-build is in your PATH environment variable and the current working directory is next to the make files.
This is an old post showing how to invoke ndk-build via the command line driven by an Application.mk and Android.mk. NDK_PROJECT_PATH=. (note the “.”) means the command line was invoked directly from the NDK project directory (the dir where Android.mk and Android.mk are).
Unfortunately, we do not have a tutorial on adding FMOD to Android Studio at this time. Maybe you could elaborate on where you are getting stuck and I can try to assist further. I will point you toward our platform-specific guide in our documentation FMOD API | Platform Details.