Answered
0
0

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?

  • You must to post comments
Best Answer
0
0

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.

ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk NDK_APPLICATION_MK=Application.mk

Android.mk

LOCAL_PATH := $(call my-dir)

#
# FMOD Shared Library
# 
include $(CLEAR_VARS)

LOCAL_MODULE            := fmod
LOCAL_SRC_FILES         := ../../lowlevel/lib/$(TARGET_ARCH_ABI)/libfmodL.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../lowlevel/inc

include $(PREBUILT_SHARED_LIBRARY)

#
# FMOD Studio Shared Library
# 
include $(CLEAR_VARS)

LOCAL_MODULE            := fmodstudio
LOCAL_SRC_FILES         := ../../studio/lib/$(TARGET_ARCH_ABI)/libfmodstudioL.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../studio/inc

include $(PREBUILT_SHARED_LIBRARY)

#
# Example Library
#
include $(CLEAR_VARS)

LOCAL_MODULE            := example
LOCAL_SRC_FILES         := common_platform.cpp common.cpp simple_event.cpp
LOCAL_C_INCLUDES        := $(LOCAL_PATH)
LOCAL_SHARED_LIBRARIES  := fmod fmodstudio

include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_PLATFORM := android-4
APP_ABI := armeabi armeabi-v7a x86 arm64-v8a
APP_STL := stlport_shared
  • Arne Nykanen

    Thank you! This made it clear to me how to set up the FMOD API with NDK and Android Studio.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.