Eclipse thinks there are problems with my Android project
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
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.
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
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
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...
I think cleaning the project should help you indeed. You can find it in Project -> Clean
精彩评论