Eclipse ADT - Unresolved inclusion jni.h

后端 未结 4 1005
予麋鹿
予麋鹿 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:19

    after add native support,right click project, add includes in c/c++ general--> paths and symbols >> includes, for example add include as %NDK_HOME%\platforms\android-19\arch-arm\usr\include

    0 讨论(0)
  • 2021-02-01 11:25

    I had the same problem some days ago. I found a fix in another question here in stackoverflow, but now I can't find the link.

    In Eclipse: right-click on your project > Properties > C/C++ General > Code Analysis > Launching and disable both options ("Run with build" and "Run as you type").

    There seems to be a problem with CDT and the Indexer, doing this you hide the problem. The editor will still complain but now you should be able to run and debug your application.

    0 讨论(0)
  • 2021-02-01 11:35

    I solved this for adt-bundle-windows-x86_64-20140321:

    1. No any environment variables is set, just pointed NDK location under Preferences > Android > NDK.
    2. I created new, clean Eclipse workspace.
    3. Deleted from my project with C++ code next files/folders:

    .settings
    .classpath
    .cproject
    .project
    project.properties

    1. 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.
    2. Clean project.
    3. Right click on project > Android Tools > Add native support
    4. Rebuild, possibly restart workspace.

    Also this solved issue with Eclipse 4.3 previously ignored build system and user defined compiler flags. Now macros folding dependent on this flags etc works fine.

    If more general - NDK plugin can properly define for you right includes and anything other required to work fine, but you need to clean your project from broken crap.

    0 讨论(0)
  • 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 <buildCommand> nodes that need to be removed. Remove the <buildCommand> node with name org.eclipse.cdt.managedbuilder.core.genmakebuilder and all its children, and the <buildCommand> node with name org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder and its children. Finally, remove the lines:

      <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. 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.

    0 讨论(0)
提交回复
热议问题