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

17,087

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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.

Share:
17,087

Related videos on Youtube

Amit
Author by

Amit

"Be a good person, but never try to prove it." #SOreadytohelp I am a professional programmer and a Certified Scrum Master (CSM) currently working as Full Stack Java Developer. Technical Skills Java (Core and Advaced), Spring Security, MicroServices, AWS, C, C++, Android, JSP, JavaScript, jQuery, AngularJS, HTML,JSP, PL/SQL, Hibernate etc. Areas of Interest Any kind of programming, R &amp; D which pays enough money Java based Application Development i.e. Core Java, J2EE, J2ME, JNI, Web Development Software designing and Solution analysis for cloud plateforms. Have knowledge of AWS architecture but can work on Azure or Google cloud too if case 1 above is true :). Web Services and Microservices Development. Web application security and related frameworks and projects like prevention against OWASP's Top 10 vulnerabilities. Algorithm optimization, fine tuning, research &amp; development.

Updated on June 15, 2022

Comments

  • Amit
    Amit almost 2 years

    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 ?

  • CCJ
    CCJ almost 10 years
    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 pilcrowpipe.blogspot.com/2011/12/…
  • androidevil
    androidevil almost 10 years
    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.
  • Sergio Viudes
    Sergio Viudes almost 10 years
    It worked for me too. But I needed to delete project from eclipse and re-import it again.
  • slott
    slott over 9 years
    I had to delete the project and then import it into the workspace before Eclipse was happy.
  • CRUSADER
    CRUSADER about 9 years
    also delete .externalToolBuilders from your project root folder if exist
  • Tary
    Tary almost 9 years
    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.
  • Smeet
    Smeet over 8 years
    Done steps suggested by bleater and then @CCJ, solve my issue.