Pages

Sunday, 11 December 2011

Removing Native Support from Android Projects in Eclipse

Adding native support (right-click project for context menu -> Android Tools -> Add Native Support...) for the NDK to a normal Eclipse Android project is easily enough done and no doubt an oft task for some, but the reverse is something I found isn't on the menu (i.e. no "Remove Native Support").

After a little bit of playing around these are the steps I figured out. I'm currently using Eclipse Helios with Android NDK r6b.

  1. Remove the lib and jni folders from your project and delete the contents of the bin folder.
  2. From Windows Explorer remove the .cproject file and .externalToolBuilders folder if either of them exist in your project's root folder.
  3. Edit the .project file in your project's root folder and remove any lines that match the following.
    Look for the following in between the buildSpec tags:
    org.eclipse.cdt.managedbuilder.core.genmakebuilder
       clean,full,incremental,
       
        
         ?children?
         ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||
        
        
         ?name?
         
        
        
         org.eclipse.cdt.make.core.append_environment
         true
        
        
         org.eclipse.cdt.make.core.buildArguments
         E:\dev\android\android-ndk-r6b\ndk-build
        
        
         org.eclipse.cdt.make.core.buildCommand
         bash
        
        
         org.eclipse.cdt.make.core.cleanBuildTarget
         clean
        
        
         org.eclipse.cdt.make.core.contents
         org.eclipse.cdt.make.core.activeConfigSettings
        
        
         org.eclipse.cdt.make.core.enableAutoBuild
         false
        
        
         org.eclipse.cdt.make.core.enableCleanBuild
         true
        
        
         org.eclipse.cdt.make.core.enableFullBuild
         true
        
        
         org.eclipse.cdt.make.core.fullBuildTarget
         V=1
        
        
         org.eclipse.cdt.make.core.stopOnError
         true
        
        
         org.eclipse.cdt.make.core.useDefaultBuildCmd
         false
        
       
      
    
    and
    
       org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
       full,incremental,
       
       
      
    
    Look for the following in between the natures tags:
    org.eclipse.cdt.core.cnature
      org.eclipse.cdt.core.ccnature
      org.eclipse.cdt.managedbuilder.core.managedBuildNature
      org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
    
  4. Delete your project from your Eclipse workspace (but don't select the delete the files on disk option) and then re-import from the same directory.
All done.

5 comments: