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
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.
For those of you who don't want to install preview version of ADT, there is a workaround described here.
- Open properties of project in Eclipse then Resources -> Resource filters.
- Click the "Add..." button -> Check "Exclude all", "Files and folders", "All children". In the text entry box input ".svn" (without quotes).
- Restart Eclipse.
I had the same problem with .git folder, it worked like a charm.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With