Eclipse keeps Building workspace... and Building workspace... and Building workspace
Asked Answered
D

9

27

Why would Eclipse, when building an Android project, get stuck in an infinite loop for Building workspace... and (re) Building workspace... and (re) Building workspace...

Is this a known bug?

What is the proper way to get out of this loop?

Notes:

  1. If I uncheck Project > Build Automatically, it builds fine and even exports a perfectly running signed release APK.
  2. This problem only started after I upgraded to the latest SDK r19. Prior to that (SDK r11) I never experienced this problem.
  3. Bug 160868 describes exactly this problem. But hasn't it being solved since then?
  4. A similar problem description found here but like the previous one, it's old and not directly related to Android development.
  5. Issue 27940 suggests a bug in handling a const named BuildConfig.DEBUG which may or may not be related. But hasn't it been fixed in r18???
  6. I found this great tip for auto tagging / date-stamping in the Android build system, but I am not using anything like that, in addition to double-checking and verifying that builders come at the right order the Project builders list order (same order as other projects that do not exhibit this infinite-loop build behavior).
  7. My hunch tells me there might be a lock-file or flag that somehow got stuck (read-only mode?) and thus confuses the build system. Any idea what that boolean may be and where to find it?
  8. If I first open another project in the same workspace (that doesn't exhibit this problem), the project that has this problem miraculously stops the infinite rebuilding. This doesn't happen if I reverse the order of which project is opened first. Does this imply gremlins in the Eclipse/SDK/ADT build system?

No "blind shooting" please: answer this question only if you have personally experienced this amazing phenomenon (and solved it) or can point to an article that experienced this amazing phenomenon (and solved it).

Discredit answered 17/6, 2012 at 21:54 Comment(1)
Have you tried to create a new Workspace and import our Project/Code/Whatever then? Also you can try to use the Project -> Clean function as already mentionedAligarh
D
27

Turns out bug 27940 hasn't been fixed yet.

I use the following workaround:

  1. Disable "Project > Build Automatically"
  2. Project > Clean
  3. Project > Build All
Discredit answered 27/6, 2012 at 1:30 Comment(0)
C
3

Did you add your workspace to a Windows 7 library (i.e. the Windows Explorer Favorites or Windows Explorer Libraries)? Another user had a similar issue here.

If you have something open in a different editor (in the target directory of your project), this can also cause an infinite "Build Workspace" loop.

Catamnesis answered 18/6, 2012 at 1:33 Comment(8)
+1 for guessing correctly that it's a Windows 7 workstation (64-bit). No, I didn't add my workspace to a Windows 7 library. Also, I verified that no file in that workspace is open elsewhere. Your answer/questions dis prompt me to check the workspace which happens to be on a Samba share, but even after rebooting that server (after 6+ months), the same problem as described above persists.Discredit
Yes, I copied the entire workspace verbatim to the local hard drive (short pathnames with no spaces) and the problem persists. In a way I am relieved that moving to a local filesystem didn't solve the problem because then I wouldn't have an explanation for: 1. Why did the problem start only after upgrading from SDK r11 to r19? 2. Why does this occur only for this particular project and not the other?Discredit
I'm not sure... but updating from r11 to r19 is a pretty big jump. Maybe something went wrong while updating? Have you seen this post by the way? Perhaps you have a corrupt drawable file or something in your project. You might also have a circular dependency somewhere in your XML files (i.e. one id references another id which references the first id and the whole thing goes on in a circular loop of death).Catamnesis
Also, do you happen to have duplicate file names anywhere? This could also cause a circular loop or something (although more likely you would get a stack overflow exception...)Catamnesis
Well, I checked for everything you mentioned and couldn't find anything even remotely suspicious. On the update from r11 to r19, I did a clean re-install of the entire Eclipse/SDKs/ADT. I don't like to install stuff if I don't absolutely need it (or if I don't understand what it's for) so I didn't install the Android Support r8 currently available. Could this pose a problem? What is that package for? Also, under Android Dependencies there is a reference to annotations.jar. What is it? Do I really need it?Discredit
It might have to do with the way you are organizing your libraries. I believe there were a couple changes made with the release of r17. All 3rd party libraries/dependencies should be placed in the "libs" folder in your project explorer, and then subsequently added to your project's build path. Android Support r8 refers to the Android Support Package... you would know if your project required this or not. Basically, it provides support for Fragments and a bunch of other things all the way back to API 8.Catamnesis
Yes, I'm familiar with that libs folder change (in part thanks to a poor guy who posted his ordeal here) and I've already configured everything properly. Fortunately for me I am able to produce both debug & release APKs but this infinite loop is pretty annoying and gives me the feeling that I can't trust my build environment. I'll live with that for now, until r20 is released.Discredit
You could always try rebuilding your project file-by-file from scratch too, if that's not too inconvenient. Since your other projects seem to be working correctly and all...Catamnesis
H
2

I solved it by opening my module's .project file. There were two redundant entries and deleting one helped:

<buildCommand>
    <name>org.eclipse.m2e.core.maven2Builder</name>
    <arguments>
    </arguments>
</buildCommand>
<buildCommand>
    <name>org.eclipse.m2e.core.maven2Builder</name>
    <arguments>
    </arguments>
</buildCommand>

Sometimes it can also be caused by the following two entries from which you have to remove the older org.maven.ide entry

<buildCommand>
  <name>org.maven.ide.eclipse.maven2Builder</name>
</buildCommand>
<buildCommand>
  <name>org.eclipse.m2e.core.maven2Builder</name>
</buildCommand>

It may also be that there are two identical natures:

<natures>
    <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<natures>
    <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>

or two natures from which one is old

<natures>
    <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<natures>
    <nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>

Just delete the redundant one or the old org.maven.ide.eclipse.maven2Nature

Headlong answered 28/1, 2016 at 9:56 Comment(3)
Neither of these was the case for my "nearly endless build problem", but it helped me find another one - for some reason, eclipse, in its infinite wisdom, decided to add a javascript validator to my GWT project (which creates a LOT (!) of Javascript, but none of that needs to be validated). After removing that, my build is as fast as it should be. +1 for putting me on the right track.Lubricate
Interesting! How did you disable the java script validation? Via Project Right click \ Properties \ Validation or did you edited the project file (remove the org.eclipse.wst.jsdt.core.javascriptValidator)?Headlong
Yep, just deleted the validation entry and the javascript nature in the .project file.Lubricate
D
1

I had this same issue pop up for me and for awhile I couldn't figure out why. Then I finally figured out what was causing it (for me anyway).

It turns out I had an old project in my workspace that uses one of my custom libraries but the build path was not setup properly to use the library (its a shame Eclipse couldn't simply tell me that!). I had copied this workspace from another hard drive and I guess the file paths were all different now.

So, if any of your projects in your workspace use any external libraries make sure the build path has your library defined (Properties -> Java Build Path -> Projects[tab].

I hope that helps someone else.

Dyspnea answered 9/8, 2013 at 23:26 Comment(0)
B
0

Apart from building all project you can Close the projects that are finished.
click on the finished project and
go to
project ->close project
hope this will work

Bowser answered 19/6, 2014 at 11:56 Comment(0)
H
0

Both projects are referenced to each other.

Go to "Project->Properties->Project References" and check the references on both projects, that causes like an endless loop when building automatically.

Hepzi answered 12/11, 2014 at 15:23 Comment(0)
P
0

In my case this could be solved in the following way:

I had a command line window open with the current directory set into a target-folder of the projects to be build. That caused the infinite loop. Closing the window and problem solved.

I guess, that if something prevents eclipse to remove some target folder, it will try over and over again.

Poleaxe answered 18/5, 2015 at 12:6 Comment(0)
H
0

I had the same problem and resolved it by remove: Project > Properties > Builders > JavaScript Validator

I had no javascript on my webapp.

Hawkins answered 13/4, 2017 at 8:10 Comment(0)
D
0

To add my two cents: Yes, it's 2019, so Eclipse 2019-06 is installed now... eyeroll I mean I occasionally had the problem with earlier versions, too, but after upgrading to Eclipse 2019-06 I suddenly had three such "sleepers" running in parallel and wasn't able to do anything any more.

To make it work again I had to delete the directory tree of my projects in my Maven repository. So in my case I only had to delete the directory ~/.m2/repository/com/sjngm.

Then I restarted Eclipse and during the start-up it seemed to download the now missing dependencies underneath that directory from our internal repository.

Disused answered 24/6, 2019 at 12:59 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.