I'm having a similar problem to what this person was having:
Android NDK import-module / code reuse
But for some reason when I implement the solution that they listed, it doesn't work for me. The only difference I have in my project is that I am using 1 makefile for the entire project. So, the modules look like this: (... = more files or paths)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mod1
LOCAL_C_INCLUDES := $(LOCAL_PATH)/to/c/includes \
... \
LOCAL_SRC_FILES := stringTester.cpp \
... \
include$(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := mod2
LOCAL_C_INCLUDES := $(LOCAL_PATH)/to/c/includes \
... \
LOCAL_SRC_FILES := localSourceFile.cpp \
... \
include$(BUILD_STATIC_LIBRARY)
and so on for 2 more modules, then in the final module:
include $(CLEAR_VARS)
LOCAL_MODULE := sharedMod
LOCAL_C_INCLUDES := $(LOCAL_PATH)/to/c/includes \
... \
LOCAL_STATIC_LIBRARIES := mod1 mod2 mod3 mod4
... \
include $(BUILD_SHARED_LIBRARY)
and in my java file:
package com.string.test
public class javaTest{
public native String returnAString();
static{
System.LoadLibrary("sharedMod");
}
}
The problem I'm running into is that I cannot call any methods from the static libraries, such as any method in stringTester.cpp, but if I move that file to be included in the module that creates the shared library, everything works as it should, the Java wrappers are correct and methods return the data I expect. The only reason why I don't move all the files into a shared library are they are separate and evolving projects, such as our physics engine and so forth.
I have also tried separating the modules with each module having its own makefile, and also having a cpp file in the shared library that called the methods in the static libraries but I would get a lot of unresolved reference failures. One other solution I have tried was to use LOCAL_WHOLE_STATIC_LIBRARIES to load the static libraries but that gave me unresolved reference errors as well.
Any help or suggestions are appreciated. I'm at my wits end, and at a roadblock.