首页 > 代码库 > JNI在eclipse中出现Unresolved inclusion: <jni.h>或Type 'jint' could not be resolved等解决方法

JNI在eclipse中出现Unresolved inclusion: <jni.h>或Type 'jint' could not be resolved等解决方法

在eclipse中经常出现这类错误,include文件报错或者是jint,jclass,JNIEnv could not be resolved等,但可以编译通过,可以经过这个步骤消除这些错误或警告

1. 打开.project,删除cdt部分

    <buildSpec>        <buildCommand>            <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>            <triggers>clean,full,incremental,</triggers>            <arguments>            </arguments>        </buildCommand>        <buildCommand>            <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>            <arguments>            </arguments>        </buildCommand>        <buildCommand>            <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>            <arguments>            </arguments>        </buildCommand>        <buildCommand>            <name>org.eclipse.jdt.core.javabuilder</name>            <arguments>            </arguments>        </buildCommand>        <buildCommand>            <name>com.android.ide.eclipse.adt.ApkBuilder</name>            <arguments>            </arguments>        </buildCommand>        <buildCommand>            <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>            <triggers>full,incremental,</triggers>            <arguments>            </arguments>        </buildCommand>    </buildSpec>    <natures>        <nature>com.android.ide.eclipse.adt.AndroidNature</nature>        <nature>org.eclipse.jdt.core.javanature</nature>        <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>    </natures>

2. 删除.cproject文件

3. 打开工程,refresh,然后右键->properties->Android Tools -> Add Native Support

经过上述步骤就不会出现之前的那些错误和警告了。

JNI在eclipse中出现Unresolved inclusion: <jni.h>或Type 'jint' could not be resolved等解决方法