Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse says my Android project(s) contain(s) errors, but there aren't any

Since last night, Eclipse hasn't been letting me run any of my projects and gives me the error "Your project contains error(s), please fix it before running it".

  • This happens regardless of which project I use.
  • There are no code errors in any projects
  • There are no missing files (R.java, etc.) or folders (src, res, etc.)
  • There are no errors in the console (even on verbose) or the error log screen
  • I've cleaned all the projects, and each individual project many times
  • I've restarted ADB, Eclipse, and my computer

I have no idea what to do next, so hopefully its fixable. NOTE: I am using Git, and this occurred after switching to my master branch to export a new update to one of my apps.

Thank you in advance! (:

Edit 1: I have also tried deleting and re-importing the projects before I posted this.

like image 826
Nick Badal Avatar asked Dec 06 '11 23:12

Nick Badal


2 Answers

Click Window -> Show View -> Problems, that should show what exactly Eclipse thinks is wrong with your project. Sometimes you can simply delete the problem from that view, and Eclipse believes you everything is fine (yep, weird, I know).

Also, after you switch branches using an external source control tool (one not integrated into Eclipse through a plugin), Eclipse sometimes won't pick up all changes, you'd need to manually refresh the whole project file tree.

If nothing else helps, try setting up a new Eclipse workspace and importing your project there.

like image 69
olex Avatar answered Nov 02 '22 13:11

olex


check your build paths - there could be jars and dependencies that are outside of the app that need to be opened or imported.

another trick is to edit an xml file, just change one word to intentionally cause an error, save the file, then change it back to proper syntax and save again. Error magically disappears.

another trick is to edit a java file, (cause error, save, fix error, magically error free)

like image 32
CQM Avatar answered Nov 02 '22 12:11

CQM