How to remove native support from an Android Project in eclipse because eclipse is showing errors in jni?

前端 未结 5 2091
暖寄归人
暖寄归人 2020-12-14 07:12

I accidentally clicked on \"Add Native Support\" inside \"Android Tools\"... That messed up all the jni files of my project. How do I undo that ? How to remove Native suppo

相关标签:
5条回答
  • 2020-12-14 07:56

    Open up your .project file in a text editor and just delete the entries for CDT and C nature. They are easily distinguished from those of JDT. I have done this several times and it's nothing dangerous but make a backup copy for safety.

    EDIT: It might be possible also with Project Properties -> Builders -> Remove CDT Builder but never tried it.

    0 讨论(0)
  • 2020-12-14 08:01

    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.

    0 讨论(0)
  • 2020-12-14 08:02

    With the new ADT 20, if the project has a jni folder or/and an Android.mk file the c++ nature is added by the plugin by default,

    In general to remove the C++ nature, you just need to delete the .cproject file in the project tree, remove and re-import project in the workspace and you're good to go (c++ project nature removed).

    But I think you should just add the macro definitions and build imports and eclipse will work just fine. If you go to

    Project properties->C/C++ general->Paths and symbols
    

    and there you add the path to the NDK includes for the corresponding platform (something like)

    {NDK_PATH}/platforms/android-9/arch-arm/usr/include 
    

    and all your build script added imports as well as any build script declared macros eclipse will handle the jni stuff just fine.

    0 讨论(0)
  • 2020-12-14 08:06

    Do following steps, Hope it can help you.

    After Android tools ->Add native support. It will gen cpp file on jni folder. And eclipse can not resolved it. This is a fixing way.

    1. Step 1

      Right Click PJ -> add New Folder -> In dialog add new folder, click Advanced>> check Linked Folder -> Borrow to [{NDK_PATH}/platforms/android-21/arch-arm/usr/include ] ( i used android -21, you can change it) (1)--> OK

    2. Step 2

      Right click PJ -> Properties -> C/CC general ->Paths and Symbols ->Include tab -> Add ->Work Space -> select include folder (1) in your project -> OK . Refresh and rebuild.

    0 讨论(0)
  • 2020-12-14 08:12

    just remove the jni folder and clear project in c/c++ interface

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