Eclipse / Android : "Errors running builder 'Android Pre Compiler' on project..."
AndroidEclipseNullpointerexceptionAdtAndroid Problem Overview
Attempting to do some work on an Android project I haven't worked on for a couple of months, yet every time I attempt to build the project Eclipse throws up a dialog saying:
'Building workspace' has encountered a problem
Errors occurred during the build.
Errors running builder 'Android Pre Compiler' on project 'XXX'
java.lang.NullPointerException
I'm running Eclipse on a Mac with an Android project build target 4.0.3 (API Level 15) and I've the following versions of things installed
- Eclipse - 3.7.2
- Android Development Tools - 21.0.1
- Android SDK - up to 17
I've already tried a few things, like starting a whole new workspace, installing this 'Subversive SVN JDT Ignore Extensions', upgrading everything, making sure I don't have any files without extensions in my source folder (or anywhere else), ensuring my Java compiler is 1.6 and switching it off and on again.
EDIT
Here's the stack trace from the Eclipse error log for this problem:
java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.build.builders.PreCompilerBuilder.build(PreCompilerBuilder.java:673)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:513)
at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:432)
at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:305)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
And the session data:
eclipse.buildId=M20120208-0800 java.version=1.6.0_37 java.vendor=Apple Inc. BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US Framework arguments: -keyring /Users/onemick/.eclipse_keyring -showlocation Command-line arguments: -os macosx -ws cocoa -arch x86_64 -data /Projects/_EclipseWorkspace -keyring /Users/onemick/.eclipse_keyring -showlocation
ANOTHER EDIT
OK, so more searching led me to this page, which suggests that this issue is definitely related to the presence of files without an extension in my project - however I don't know which file and for the life of me I can't find any in that project!
I'd even be happy if someone could explain what this error means and how I might get more debug info about the underlying error.
Android Solutions
Solution 1 - Android
For those of you who don't want to install preview version of ADT, there is a workaround described here.
> 1. Open properties of project in Eclipse then Resources -> Resource filters. > 2. Click the "Add..." button -> Check "Exclude all", "Files and folders", "All children". In the text entry box input ".svn" (without quotes). > 3. Restart Eclipse.
I had the same problem with .git folder, it worked like a charm.
Solution 2 - Android
I always hate answering my own questions, but this is a genuine solution.
The 21.0.1 version of the ADT tools has a bug that prevents a project building if you have any files without extensions in them. This is a particular problem for users (like me) using subversion with has extension-less files.
One recommended solution is to install these 'subversive' Eclipse plugins (Help > Install new Software > Work with your Eclipse version site > Expand 'Collaboration' > Choose 'Subversive SVN JDT Ignore Extensions' and 'Subversive SVN Team Provider') but this didn't work for me (I'm on Indigo, perhaps on Juno it works).
The solution is to install the 21.1 preview version of the ADT tools and SDK manager from Google. Clear instructions can be found here and you can read all the background add your voice to the angry mob of developers here.
Solution 3 - Android
I just restarted Eclipse and the problem got solved.
Solution 4 - Android
I also had the same problem and i realised that i had closed another project that was connected with the one I was building. Once i opened it everything disappeared.
Solution 5 - Android
May be you have close 'appcompact_v7' library to create new file. this solved my problem by open it back
Solution 6 - Android
I meet this error,and delete all .svn file, my project can't work,when process 55%
and I find this is an empty res dir in my project,I don't know how it coms,but when delete the empty res dir,my project workd,
so,you should check all your files in your project.
Solution 7 - Android
I was also facing the same issue, and wasted a lot of time fixing this, also the above given solutions doesn't work for me. I solved this problem by going to Eclipse -> Help -> Check for updates, and then restarting eclipse after update finished.
Solution 8 - Android
If you have accidentally closed the library projects that are essential for running your project then just open them in eclipse. This error must vanish.
Solution 9 - Android
Another case: I closed the current project (with building error message), discarded the SVN repository in use, recompile:
Building error
I add the repository location:
Building ok!
Solution 10 - Android
For solving this issue I need to run eclipse as administrator
Solution 11 - Android
i encountered this problem recently and the solutions given above did not work for me. i did not have any files without extensions. It so happened that after adding a new project from existing code, there was a setup error that seems to have messed up the state of eclipse. After that, any project in the workspace that i tried to clean or build was giving the Android Pre-Compiler error with the java.lang.NullPointerException.
i found that the main.xml files inside