Well, the situation I have is the following:
I'm working with an special android device that has some functions extra attached to it. My application is working in android ndk and now I want to call some of the functions provided by the manufacturers.
This functions come in two different .so files, from now mylib1 and mylib2. Also, I got the headers from the manufacturers to be able to implement it fully in ndk.
The problem is that neither of them work. I'm trying to link them to my native-lib (main library) but I get two kind of errors for the same way of linking (I think this part is pretty strange)
For mylib1 I have the following error while I'm trying to compile the code:
[armeabi] SharedLibrary : libnative-lib.so
C:/Users/JuanJo/Documents/JorgeVerdeguerGomez/Workspace/PCPA/app/src/main/jni/native-lib.cpp:17: error: undefined reference to 'Lib_Beep()' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
In my first approach, I thought that I was just linking it wrong, despite following multiple answers found in this page and even the code from the google guide itself, but then, I tried to use some functions in mylib2.
The strange thing is that this library does compile, and does provide the definitions to the methods in its header (not for the other header, already tried it) but when I try to run the application, it just stops the app when trying to execute: System.loadLibrary("native-lib");
If I comment that line, the application doesn't stop (it doesn't do anything because everything is in that library, but at least it shows the starting screen)
I also seem to be not able to find any log or file that tells me why it stopped.
After the explanation, I will show you my android.mk and hope you can help me:
LOCAL_PATH :=$(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib1
LOCAL_SRC_FILES := libAndroid.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib2
LOCAL_SRC_FILES := libAndroidEmvKernel.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libnative-lib
LOCAL_SHARED_LIBRARIES= \
mylib1 \
mylib2
LOCAL_SRC_FILES := \
native-lib.cpp \
restOfCppFiles.cpp
LOCAL_LDLIBS := -llog \
-landroid
include $(BUILD_SHARED_LIBRARY)
To be honest, I think that probably the .so are someway not compiled properly or anything like this, because I think is strange to have two different reactions for the same procedure of linking and the same type of files.
Feel free to ask for more info if you think you need it.