Eclipse ADT - Unresolved inclusion jni.h

后端 未结 4 1064
予麋鹿
予麋鹿 2021-02-01 10:47

On my Windows platform, I have the latest version of adt bundle (20140321) and ndk (r9d) installed. The installation is as clean as it gets. The environment variables NDK_ROOT,

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 11:44

    I ran into a similar problem with a working project with Android NDK-based code after updating to Eclipse Kepler. I observed similar things: the header files would correctly be listed under "includes" in the project, the actual build (via ndk-build) worked fine, but Eclipse's editor couldn't locate any headers in standard system directories (all headers with < > brackets).

    I tried many different fixes, including switching toolsets, rebuilding indices etc. without success.

    Finally, I removed the C nature entirely from the project, and added it back via the "Android Tools" menu in Eclipse.

    Removing the C nature:

    The only way I could find to reliably removed the C nature from the project was by hand editing Eclipse's .project file for the project.

    1. Close the Eclipse project (e.g. by quitting Eclipse).

    2. Open the .project file in a text or xml editor. There will be at least 2 nodes that need to be removed. Remove the node with name org.eclipse.cdt.managedbuilder.core.genmakebuilder and all its children, and the node with name org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder and its children. Finally, remove the lines:

      org.eclipse.cdt.core.cnature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature

    3. Completely remove the .cproject file.

    Adding back the Android Native nature

    Reopen the project in Eclipse. Then right-click on the project in the Project Explorer, and from the "Android Tools" contextual menu, choose "Add Native Support...".

    Android Tools -> Add Native Support...

    Looking at the changes made in the .project and .cproject files before and after this change, it appears that it primarily gave new version numbers to the Android NDK tools. In any case, it solved the issue for me.

提交回复
热议问题