I am unable to use .c files in my NDK projects within eclipse 3.8. Consider the following code:
#include <jni.h>
JNIEXPORT void JNICALL Java_com_atd_ndkdemo_NDKDemo_charManip(JNIEnv* env, jobject obj, jcharArray chrs)
jchar* cchar0 = GetCharArrayElements(chrs, 0);
jchar* cchar1 = (*env)->GetCharArrayElements(env, chrs, 0);
}
Here is my Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := NDKDemo
LOCAL_SRC_FILES := NDKDemo.c
include $(BUILD_SHARED_LIBRARY)
cchar0 doesn't complain until I compile, then I get a method undefined
cchar1 complains before I compile, but is able to compile (if i omit cchar0). I get a method undefined or not part of struct or something similar.
This has me baffled. I have completely reinstalled eclipse/jni/ndk plugin and still same issue. There is a little bug icon next to cchar1 on the left where I set breakpoints if that helps. Also, I have not modified jni.h or any other files. It is important that I leave my file as .c.
edit
Method 'GetCharArrayElements' could not be resolved
Screenshot: https://i.stack.imgur.com/i7O51.png
Screenshot to build success: https://i.stack.imgur.com/DbXAK.png