NDK(4)"Unresolved inclusion jni.h”的解决方法

时间:2021-07-17 17:04:45

3种解决办法:

1.重新初始化eclipse对该project的native support

1. 在eclipse中关闭指定Project

2. 用其他编辑工具打开该project的.project文件,删除以下内容:

后面几行在<nature> 下

     ......
<buildCommand>
  <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
  <triggers>clean,full,incremental,</triggers>
  <arguments>
  </arguments>
</buildCommand>
......
<buildCommand>
  <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
  <triggers>full,incremental,</triggers>
  <arguments>
  </arguments>
</buildCommand> ...... <nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<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

NDK(4)"Unresolved inclusion jni.h”的解决方法

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.