I ran into problem when I had multiple C files in my project. Single C file was OK for me.
I was getting undefined reference error while doing this.
Then I found out the solution after a lot of search in google.
You can check this post before going through this post.
This is about setting up NDK in MAC.
Starting with NDK for Android – A Simple example. OR How to run a C code in android?
I have to make the change in the Android.mk file to include other files to compile.
This is the content of my Android.mk file
LOCAL_PATH := $(call my-dir)
LOCAL_LDLIBS := -llog
LOCAL_MODULE := ndksetup
LOCAL_SRC_FILES := native.c test.c test_2.c
Here is my native.c code in which I am including those two files test.c and test2.c
// my test file
#define DEBUG_TAG "NDKSetupActivity"
void Java_com_ndksetup_NDKSetupActivity_printLog(JNIEnv * env, jobject this, jstring logString)
const char * szLogString = (*env)->GetStringUTFChars(env, logString, &isCopy);
__android_log_print(ANDROID_LOG_DEBUG, "TAGGGGG", "NDK: %s", szLogString);
(*env)->ReleaseStringUTFChars(env, logString, szLogString);
int Java_com_ndksetup_NDKSetupActivity_fibonacci(int value)
int p = 8;