I am working on a simple OpenCV code to display an image after undergoing sobel operation. I have included all the necessary paths to the Project Properties for including th
JNIEXPORT jstring JNICALL Java_com_example_faceextractiontest_Makeover_hello(JNIEnv* env, jobject obj){
const char* c = "hello how are you i am ahmad raza";
jstring s = env->NewStringUTF(c);
return s;
}
This worked for me
Step 1: Project Properties -> C/C++ General -> Path and Symbols
Step 2: Select 'include' tab, Add -> $ANDROID_NDK_HOME/platforms/android-19/arch-arm/usr/include(Your own path) then, Check 'All languages'
Step 3: Apply -> OK
That's it. My solution.
Chances are that you are using C
syntax in CPP
file
I had the same error
Just switch to the right syntax and Problem will be solved C syntax
return (*env)->NewStringUTF(env, "Hello from JNI !");
C++ Syntax
return (env)->NewStringUTF("Hello from JNI !");
After switching from C to C++ syntax my problem got solved.
I had this issue. Based on my "solution," it seems to be something funny going on in Eclipse, since I had another project open with (as far as I was able to tell) the exact some properties, paths, etc., besides for being labeled a Library Project.
Just by observing the corresponding struct in jhi.h, the callback prototypes are all there! Ctrl-click the include statement and Eclipse will even link you the reference!
Go to the project's Properties -> C/C++ General -> Code Analysis. Click the "Use project settings" radio button (or "Configure Workspace Settings..." button). Disable (uncheck) the "Method cannot be resolved" checkbox. Click "Apply," "OK." Then for your project, refresh, clean, refresh, build.
There must have been something I did differently in creating the new project. Or maybe it was because of the locations of the projects, or the fact that the previous was a Library. Maybe it really is an Eclipse bug? For reference, I'm using ADT v21.1.0-569685 and NDK r8e for Windows.