您的位置:首页 > 编程语言 > Java开发

window平台下 Eclipse Ndk开发中的Method 'NewStringUTF' could not be resolved问题

2015-09-04 19:24 666 查看

最近需要用到android的ndk,但是在eclipse中,一直提示Method 'NewStringUTF' could not be resolved(方法“NewStringUTF”无法被解析)。可问题是,jni.h等一系列的依赖库,都已经导入了,并且也能正常的使用build来编译出动态库文件。但是无奈的就是eclipse的cdt,仍旧会不停的提示这类的错误,导致整个项目没办法编译过去。

后来,我先问了baidu,然后又问了google,最终折腾了半天也没很好解决这个问题的办法。

 

最后还是让我在这里找到了答案:

http://stackoverflow.com/questions/15899813/eclipse-method-newstringutf-could-no

原文如下:

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。

具体操作如下:

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.
<span style="font-family:SimSun;font-size:14px;"></span>项目右键->属性->c/c++常规->Code Analysis,选择"Use project settings"  中的方法无法被解析(Method cannot be resolved)取消选择,应用->确定,然后刷新、清理、刷新、build项目。

搞定。

版权声明:本文为博主原创文章,未经博主允许不得转载。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: