Type 'JNIEnv' could not be resolved and related errors

80 views
Skip to first unread message

Jeff Archer

unread,
Dec 23, 2015, 5:40:12 PM12/23/15
to android-ndk
After following the instructions presented in <android-ndk>/docs/Start_Here.html
Eclipse is reporting the following errors, which makes it not possible to make changes to the JNI code and do any further development.
Errors:
  Method 'NewStringUTF' could not be resolved
  Type 'JNIEnv' could not be resolved
  Type 'jobject' could not be resolved
  Type 'jstring' could not be resolved

The exact procedure is...
1. Open the document in a browser (<android-ndk>/docs/Start_Here.html)
2. Satisfy all indicated prerequisites (This includes installing Eclipse, ADT, etc.)
3. Follow the instructions as presented by this document
4. This results in the successful build of the app, executing on the device, showing the text "Hello from JNI!  Compiled with ABI x86", in my case.

All good up to this point, but...

5. Open the hello-jni.c file in Eclipse.  (changes to file are not required)

This is what causes the errors to show up in the Problems tab of Eclipse

Now attempting to launch the app again from Eclipse, exactly as was done the first time, results in the error
"Your project contains error(s), please fix them before running you application."

At this point, I can exit Eclipse, go to command prompt and ndk-build
But, must close the hello-jni.c file before exiting Eclipse so that Eclipse won't see the file when it is restarted.
Then go back into Eclipse and can launch app again.

This makes it very inconvenient to modify the JNI code as modify/compile/debug cycle will need to occur many times...

How can I overcome this difficulty so that I can modify my JNI code in Eclipse?


Reply all
Reply to author
Forward
0 new messages