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>
以上第一种第二种方式我都试过,可以解决不同的问题。此内容为转载,如有因为欢迎留言,若有侵权问题,请及时留言告知,以免产生误会!