Android NDK *** could not be resolved

来源:互联网 发布:网络研修论坛研讨题 编辑:程序博客网 时间:2024/04/30 06:01

Type '*****' could not be resolved
Method '******' could not be resolved
等等很多诸如此类的错误


解决方法:
是由于没有将jni.h导入的缘故,而这个文件在ndk的目录下面。所以,参照以下步骤:
Project Properties -> C/C++ General -> Path and Symbols
选择include标签,Add -> $Android_NDK_HOME/platforms/android-14/arch-arm/usr/include
且选中All languages.
最后Apply -> OK
这样错误就解决了。

 

如果添加了头文件还是问题,那可能是因为工程是C++工程,但代码是用的C风格的代码,解决方法为将工程文件".project"中的“<nature>org.eclipse.cdt.core.ccnature</nature>”行去掉保存,重新打开Eclipse工程。参见:

http://stackoverflow.com/questions/11666711/type-jint-could-not-be-resolved-and-jnienv-jclass

 

还有一种方法:在extern "C"的大括号中加入#incldue <jni.h>

2 1
原创粉丝点击