26

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 support from my Android Project ?

Amit
  • 13,134
  • 17
  • 77
  • 148

5 Answers5

33

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.

bleater
  • 5,098
  • 50
  • 48
  • 5
    it is sometimes necessary (as of eclipse Kepler at least) to delete the project reference from your workspace (not contents on disk) and then re-import it after following the above steps. See http://pilcrowpipe.blogspot.com/2011/12/removing-native-support-from-android.html – CCJ May 27 '14 at 21:59
  • It worked for me, Thank you. I've removed the build comands from eclipse, and now I don't see C/C++ in the properties of my project. – androidevil May 29 '14 at 15:20
  • It worked for me too. But I needed to delete project from eclipse and re-import it again. – Sergio Viudes Jul 22 '14 at 07:32
  • also delete .externalToolBuilders from your project root folder if exist – CRUSADER Mar 12 '15 at 11:26
  • The steps above were helpful but after following them I could no longer build my app. I was getting a fairly obtuse error message: make: *** [clean-installed-binaries] Error 127. Searching for this error message did not provide any indication of the specific problem or a solution. The only solution I found was to remove the project and then re-add it and then the problem magically went away. – Tary Jul 30 '15 at 15:13
  • Done steps suggested by bleater and then @CCJ, solve my issue. – Smeet Dec 25 '15 at 06:00
27

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.

Tancho
  • 1,581
  • 3
  • 22
  • 40
4

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.

WindRider
  • 11,958
  • 6
  • 50
  • 57
  • I had to delete the project and then import it into the workspace before Eclipse was happy. – slott Nov 04 '14 at 08:53
2

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.

Community
  • 1
  • 1
Son Nguyen Thanh
  • 1,199
  • 15
  • 19
0

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

Varun Chaudhary
  • 370
  • 4
  • 19