NDK(4)"Unresolved inclusion jni.h”的解决方法
3种解决办法:
1.重新初始化eclipse对该project的native support
1. 在eclipse中关闭指定Project
2. 用其他编辑工具打开该project的.project文件,删除以下内容:
后面几行在<nature> 下
1 ...... 2 <buildCommand> 3 <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> 4 <triggers>clean,full,incremental,</triggers> 5 <arguments> 6 </arguments> 7 </buildCommand> 8 ...... 9 <buildCommand> 10 <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> 11 <triggers>full,incremental,</triggers> 12 <arguments> 13 </arguments> 14 </buildCommand> 15 16 ...... 17 18 <nature>org.eclipse.cdt.core.cnature</nature> 19 <nature>org.eclipse.cdt.core.ccnature</nature> 20 <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> 21 <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
3. 删除.cproject文件
4. 在eclipse里打开原来的project, refresh,然后右键->properties->Android Tools -> Add Native Support
2.include path
项目右键 > Properties > C/C++ General > Paths and Symbols > Add ndk目录下的头文件
如: 我用的是19,21出错.
/home/admin/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include
3.重建项目
保存 .project 到其它目录,当按下面操作失败时,再把 .project 拷回来.
just pointed NDK location under Preferences > Android > NDK.I created new, clean Eclipse workspace.Deleted from my project with C++ code next files/folders:
.settings
.classpath
.cproject
.project
project.properties
Eclipse > New > Other > Android > Android Project from Existing Code > then point folder with your project, let Eclipse detect it, check "Copy project into workspace" and click Ok/Next, whatever.Clean project.Right click on project > Android Tools > Add native supportRebuild, possibly restart workspace.