eclipse – Android Pre Compiler error on 21.0.1 android sdk-ThrowExceptions

Exception or error:

I check out the old android project on a different pc and I get a
Android Pre Compiler Null pointer exception error, on every save so R.java can’t be generated. The project is a library project using other library to.

The new where the project is not working is system is:
64 bit ubuntu,
ADT eclipse,
Android sdk tools 21.0.1,
Android sdk platform-tools 16
the error is:

!ENTRY org.eclipse.core.resources 4 2 2013-01-07
02:07:15.177 !MESSAGE Problems occurred when invoking code from
plug-in: “org.eclipse.core.resources”. !STACK 0
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.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

!ENTRY org.eclipse.core.resources 4 75 2013-01-07 02:07:15.717
!MESSAGE Errors occurred during the build. !SUBENTRY 1
com.android.ide.eclipse.adt 4 75 2013-01-07 02:07:15.717 !MESSAGE
Errors running builder ‘Android Pre Compiler’ on project ‘MyProject’.
!STACK 0 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.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

The project works on a old system:

The old system is:
32 bit ubuntu,
4.2.1 eclipse Juno,
Android sdk tools 21,

Git is used as a version control system.
It is a very strange problem I have checkt all of the xml run them with lint to find a xml build problem but no luck on every save the i have the same error and the R.java is not generated. Thanks

How to solve:

The Android Pre Compiler in 21.0.1 appears to be badly broken, crashing on .svn directories and .DS_Store files, and files without file extensions.

The solution that worked for me was to upgrade to 21.1 rc1 following these steps:
1. Follow instructions here: http://tools.android.com/preview-channel
2. Make sure to update both SDK Manager and ADT
3. Restart Eclipse

See this bug for more information:
http://code.google.com/p/android/issues/detail?id=42051

###

You can add a Resource Filter in each src folder properties to avoid including automatically files not desired in your project. SVN files does crash Android pre-compiler in that version.

You should click Add and select: Exclude All / *Files and folders */ All children (recursive) / and write .svn in the edit box. Click OK to save the filter. You will need clean project probably.

###

In my case the issue was caused by the .svn subfolders in the src folder. I followed the advice under comment 6 here which resolved the issue for me: http://code.google.com/p/android/issues/detail?id=42051

###

I solved the problem installing eclipse Juno and and downloaded the Android sdk 21 tools instead of sdk tools 21.0.1, it seams Ill be skipping 21.0.1.
So for me now the eclise form android is a bad idea.

###

Struggled a lot with ADT 21.0.1 too, reverting helped for me:
Eclipse -> About -> Installation Details -> Installation History -> Select Entry where Android version is 21.0.0 -> Press Revert.

Leave a Reply

Your email address will not be published. Required fields are marked *