Android: Type Method 'NewStringUTF' could not be resolved

编译一个最简单的Android NDK 例子(android-ndk-r8/samples/hello-jni)出现了错误信息:Type Method 'NewStringUTF' could not be resolved。
首先,错误信息如下:


其次,我发现这个错误仅仅在Eclipse打开c代码窗口时才出现。此时运行应用程序会出现下面的错误:

Android: Type Method 'NewStringUTF' could not be resolved_第1张图片

将错误删除,并关闭C代码窗口。

Android: Type Method 'NewStringUTF' could not be resolved_第2张图片

"Clean"之后,重新编译工程,一切正常。

Android: Type Method 'NewStringUTF' could not be resolved_第3张图片

另一种方法:

依次进入 project's Properties -> C/C++ General -> Code Analysis. 

点击 "Use project settings" 按钮 (或者 "Configure Workspace Settings..." 按钮). 

取消 "Method cannot be resolved" 选项. 


你可能感兴趣的:(Android: Type Method 'NewStringUTF' could not be resolved)