0
0

I am trying to add fmod to the AGK sdk, and modified my Android.mk file.
When I compile using NDK-BUILD I get no errors, but when I launch my app it crashes, even if I do not call any FMOD specific commands in my code…

This is my Android.mk file:

[code:1bjtxr3l]LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := fmodex
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfmodex.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../common/include
include $(PREBUILT_SHARED_LIBRARY)

LOCAL_MODULE := AGKAndroid
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libAGKAndroid.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../common/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

the name of the library referenced from the AndroidManifest.xml file

LOCAL_MODULE := template

agk includes folder

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../common/include

app source files, must be relative to the jni folder

LOCAL_SRC_FILES := main.c \
Core.cpp \
template.cpp

included system libraries

LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv1_CM -lz -lOpenSLES

LOCAL_SHARED_LIBRARIES := fmodex

included user libraris

LOCAL_STATIC_LIBRARIES := AGKAndroid android_native_app_glue

define IDE_ANDROID (for AGK) and use O3 optimizations

LOCAL_CFLAGS += -DIDE_ANDROID -O3

use arm instead of thumb instructions

LOCAL_ARM_MODE := arm

include $(BUILD_SHARED_LIBRARY)

build the native support library

$(call import-module,android/native_app_glue)
[/code:1bjtxr3l]

Any help would be greatly appreciated as I spent 2 days researching the problem with no positive outcome.

  • You must to post comments
0
0

Be aware that Android does not automatically load dynamic libraries at runtime, you must do this yourself (in the correct dependency order) in Java.

All FMOD examples have a static section in Java that loads the lib, also note we have a native_activity example that shows this too now. For native you must subsclass native activity just so you can hook some static code to load the libs before the native activity is launched (or it will crash with a sometimes cryptic error).

  • You must to post comments
0
0

I followed the native_activity example.
I am not including any FMOD commands in my code.
Just linking the shared-library crashes the app at startup.

Is there a static alternative of the fmod lib?

  • You must to post comments
0
0

Perhaps try adding to the native_activity example, you may have missed something, or at the least it will help isolate what stop it running. Also could you post the LogCat output? Crashes at startup are generally related to attempts to resolve dynamic dependencies and failing.

We do not provide a static version of FMOD for Android.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.