views:

149

answers:

5

I have an Android project and Eclipse is telling me my project has an error with its build path. Specifically, the problem view shows "The project cannot be built until build path errors are resolved". The entire project builds just fine, meaning there are no red X's on any of the files. I can build the project outside of Eclipse, deploy it to the device, and it runs just fine, so I know there isn't a problem with my source code or layouts. The strange thing is when I remove the 'src' folder from the build path in Eclipse, clean and build the project, then re-add the 'src' folder to the build path and build the project it works again. However, within a few changes it gives me the same problem.

Has anyone else encountered this before? Does anyone know of a solution? It's driving me mad!

Thanks,

-Dan

A: 

I had a similar problem. I created a new project and copied the source in there. Looks like the project file gets corrupted somewhere, sometimes...

Patrick Cornelissen
+1  A: 

I've had a similar problem where Eclipse told me it couldn't compile my project because it contained errors, though none of my files had red Xs on them. What solved it for me was deleting the project from the workspace and then re-importing. That might do it for you too... Just make sure you don't tick the "delete project from disk" option too! :P

Steve H
This worked for me too.
Omar Kooheji
+1  A: 

You may also be able to clean the project. I think that forces it to ignore any build info it had and start from scratch.

Project->Clean

Dianoga
I've already tried this to no avail.
Dan Watling
A: 

I think cleaning the project should help you indeed. You can find it in Project -> Clean

Bostjan
A: 

I haven't had this problem since I turned on the "Build Automatically" check box under the Project menu. Rebuilding the project always works now.

Fixing the problem by cleaning then building did not work as other suggested. It always resulted in the same problem. Now that the check box is on though, everything is fine. Not sure why it would make that much of a difference for Android projects.

Dan Watling