Android Add Native support - unresolved jni.h, android/log.h etc

后端 未结 4 1075
轮回少年
轮回少年 2020-12-29 12:29

Before today i use Eclipse 3.8 with Sequoyah plugin for Android NDK project. But today i decide to freshen Eclipse to Juno release with SDK and NDK.
I w

相关标签:
4条回答
  • 2020-12-29 13:04

    If you are using Eclipse Kepler the path to add the NDK include

    Properties->C/C++ General->Paths and Symbols.

    on my version of NDK the include path needed was:

    C:\Program Files (x86)\Android\android-sdk\NDK\android-ndk-r10\platforms\android-L\arch-arm\usr\include.

    It will ask you if you want to rebuild. Afterwards the errors go away.

    0 讨论(0)
  • 2020-12-29 13:09

    I often solving similar issues that is probably occur when you move or rename the working folder of the project.

    1. No any environment variables required, just pointed NDK location under Preferences > Android > NDK.
    2. Move project outside workspace. Delete from project next files/folders:

    .settings
    .classpath
    .cproject
    .project
    project.properties

    1. Reimport your project. 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 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, and easiest way to do so is reimport project.

    0 讨论(0)
  • 2020-12-29 13:10

    I've tried android-ndk-r8b with C:\Android\android-ndk-r8b in my PATH variable. Project compiled without error.
    However eclipse "says" that Unresolved inclusion: <jni.h>

    solved:

    NDK Project->New->Folder->Advanced->Link to alternate location(Linked Folder) Browse the path(for example):C:\Android\android-ndk-r8b\platforms\android-8\arch-arm\usr\include

    0 讨论(0)
  • 2020-12-29 13:15

    You can do this by choosing Properties for the project

    Properties -> C/C++ General -> Preprocessor Include..-> Entries -> Setting Entries -> CDT User Setting Entries

    Add -> Include Directory -> File System Path, and enter the path of the includes

    ndk/platforms/android-[version]/[arch]/usr/include
    
    0 讨论(0)
提交回复
热议问题