9

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.

Nick Badal
  • 681
  • 1
  • 8
  • 26
  • Try restarting your machine and then eclipse... See if its still there – blazingkin Dec 06 '11 at 23:32
  • You also may need to remove your project from eclipse and re-import it, unfortunately. Possibly similar to: http://stackoverflow.com/questions/3958716/error-unable-to-fnd-class-r-java-no-such-file-or-dir/3959675#3959675 – Gray Dec 06 '11 at 23:34
  • I've restarted eclipse and my computer like my post says. And I've already deleted and re-imported (I just did this before posting - nothing.) – Nick Badal Dec 06 '11 at 23:41

8 Answers8

21

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.

olex
  • 797
  • 5
  • 6
  • There aren't any problems, just warnings that have always been there. I've already tried deleting the project and re-importing it. – Nick Badal Dec 06 '11 at 23:41
  • Right click the project, select Properties -> Android and check that a Build Target is selected. If yes, then select a different build target, click Apply and then select the previous SDK again and clicky Apply. It sounds strange but I had similar problems and this helped. – Daniel Novak Dec 06 '11 at 23:46
  • 1
    I guess something was borked in my workspace. Creating a new one and importing the project there did the trick! Thank you :D – Nick Badal Dec 06 '11 at 23:53
  • Amazing! As it turns out when I moved from ActionBarSherlock 4.0.2 to 4.1.0 and ViewPagerIndicator 2.3.1 it somehow continued to refer to the old one (as found in the .classpath file). – albnok Jun 25 '12 at 10:21
  • I had this problem, and it turned out that one of my XML layout files had a view with an ID containing a '-'. And since the id name is turned into a Java name as it is, the '-' violated the Java variable naming rules. But Eclipse wouldn't flag it as an error. The "Problems" window brought my attention to it though. – RTF Jan 11 '14 at 22:39
2

I had this problem and I have fixed it. My issue was this:

I somehow managed to require another project in my build. That project had errors in it, which I believe is what caused the issue. I think this happened when I accidentally asked Eclipse to fix my build path or something when I was trying to fix a mistake. To correct this issue go to (on mac):

Right click on your project folder in the Package Explorer In the menu, go to "Build Path" Select "Configure Build Path" Go to the "Projects" tab (along the top).

Is there anything in there? If there is and you weren't expecting there to be, select the project that is in that folder and hit "Remove"

This fixed the issue for me. Hope it helps.

ktbiz
  • 586
  • 4
  • 13
2

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)

CQM
  • 42,592
  • 75
  • 224
  • 366
1

I think you need to clean your project. Do project -> clean. Should work fine after that.

ACC
  • 2,488
  • 6
  • 35
  • 61
  • I posted in my question that I've already tried that unfortunately. But if anyone else is having this problem, this **usually** does the trick. Not in my case. – Nick Badal Dec 06 '11 at 23:39
0

Go to your .android folder and delete your debug certificate.

E:\Users\(your profile)\.android

Inside that folder there is a file name 'debug.keystore'. Delete that, clean and try to build the project again. Sometimes this error is caused when the certificate expires.

I found this answer here and it solved my problem ;-)

Community
  • 1
  • 1
Woody
  • 1,589
  • 14
  • 16
0

I think go to project ->clean some error can be solve this problem

0

Go to Projects in the menu bar Then check the menu Build Automatically. This helped for me.

0

Try using Project->Android Tools->Fix Project Properties besides checking for your Android path. Check if your ANDROID_HOME and ANDROID_SDK are set correctly besides adding tools and platform-tools are set correctly in environment variable PATH.

Hope this helps!

Sniper
  • 29
  • 4