22

I think Eclipse is trying to make me miserable. A couple of hours ago, my project was working and compiling well. Suddenly that all changed. Eclipse somehow wipes out all changes I have made to my files(activity, manifest etc.) I make sure to save often but when I go to run the project, I get the error that I have a build error. I checked and there was none, so I go to close Eclipse, so I can reopen and see if the errors will go away. Instead what happens is Eclipse wipes clean all my files and I end up with a project on disk with lots of blank code files. I try to run anyway, and I get the error message below.

Failed to read the project description file (.project) for 'com.example.android.nfc.simulator.FakeTagsActivity.FakeTagsActivity'. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state.

Anyone have an idea what in the world this is about and how I can rectify this?

5
  • Could you update your question with the broken .project file? Commented Sep 10, 2012 at 14:25
  • What kind of project do you have? Is it a plain Java Project? Commented Sep 17, 2012 at 8:12
  • 1
    If you right-click on the project and select "Restore from Local History ...", what happens? Do you see previous versions you can restore to? Commented Sep 17, 2012 at 14:43
  • check this link <stackoverflow.com/questions/7990565/…>
    – Sabya
    Commented Oct 5, 2012 at 5:40
  • Thanks @StephenC for the fantastic tip, I am newbie, can you tell me how to do this version control ? a tutorial or a guidance will do .. thanks a gain
    – McLan
    Commented May 20, 2014 at 10:10

10 Answers 10

10

I would recommend to wipe out all the eclipse related configuration files(make sure you take the backup if you have manually made some changes in those) and import the project again, by following

File -> Import... -> Existing Project into Workspace

Make sure you take the backup of whole project before doing this.

1
  • Both the main and backup were affected.
    – Kobojunkie
    Commented Sep 10, 2012 at 5:01
3

When Eclipse gets stuck in some obscure status, I usually find useful to recreate the .metadata folder in workspace directory. It is a drastic solution, but it usually works for me. After that you can reimport all your projects.

1
  • 1
    That is true only if you don't inherit a project from a genius programmer who managed to configure his build environment such that it will only build on his own machine... relying on plugins and other add-ons that were somehow neither committed to version control nor documented elsewhere...
    – Withheld
    Commented Dec 18, 2014 at 21:18
2

This happened to me because I had a conflict in my .project file. I opened it up in a text editor and fixed the conflict (in my case, removed from ====... to >>>branch..., as well as <<<HEAD) and then I was able to open the project in eclipse.

1

I was just encountering this same issue (using Zend Studio 12, which is built on Eclipse). My problem was that I was creating a project from a Remote Server, and I was just downloading everything, which also included the .project file from the old project. It wasn't showing this error until I'd closed the program and tried to open it again (which usually wasn't until the next day).

I seem to have resolved it by making sure not to download the .project when initializing the project.

0

If the .project file is a text file, so if you have it in version control you might want to copy it over from there.

Before you trying the following make a backup of your current project state.

Assuming you don't have an old copy, you can open it in a text editor and try to see if there is something obvious wrong.

If this fails, copy the source files of your project to a fresh location (without the eclipse configuration files) and import it as a new project into eclipse.

1
  • unfortunately, I did not have it in version control. I simply make a copy of the old file and it seems Eclipse was somehow able to make changes to both.
    – Kobojunkie
    Commented Sep 10, 2012 at 5:02
0

if you still have all of your other source (.java files, AndroidManifest.xml, resources), you might be able to get your project back by simply going to the folder containing the project, removing the .project file that you say is now empty, and then using the new project wizard to recreate the project (and .project file) for you from your existing tree of source.

from the menus, select File -> New... -> Project , and then, in the first dialog, choose Android Project from Existing Code .

if you had done anything special to the .project (reliance on specific .jar files or changes to classpath), you may have to re-do these steps after you re-create your project; but at least it should pick up the code you already have.

0

If all the files are empty, and you have no working Backup, I can't help. I would recommend to use proper version control in the future.

Use git or mercurial, they have nice UI integrations (see tortoisegit/tortoisehg).

To decouple the build process and library management from eclipse, take a look at maven or gradle, this might help you in future projects.

0

If you use git, complete the merge e.g. del the head in your androidmanifest.

0

I also got the Same Issue in Eclipse but the real problem is i removed the actual Source project folder from source location (from which eclipse is trying to take the project) to some other place hence my eclipse is unable to get web.xml file since it is not available. Now i changed my source project folder location to the path where eclipse is trying to search for. Issue Resolved for me.

-1

Just delete the 'servers' folder in your workspace and try again.

1
  • It is a suggestion, and hence is suited to be a comment.
    – CinCout
    Commented Nov 2, 2015 at 6:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.