118

While compiling an android project in eclipse 3.4.2, I am getting The project cannot be built until the build path errors are resolved.

I got a temporary solution from the blog http://www.scottdstrader.com/blog/ether_archives/000921.html

The resolution was to force a resave of the selected projects (and their .classpath files):

  1. Open the project properties
  2. Select Java Build Path > Libraries
  3. Add a new, arbitrary library (to be deleted later) > OK
  4. Wait for the workspace to refresh (or force a refresh of the project)
  5. The error(s) will go away
  6. Remove the dummy library

The only other references I could find were to make minor alterations of contents of the .classpath file.

Is there any permanent fix for this issue?

Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
yokks
  • 5,683
  • 9
  • 41
  • 48
  • What are the actual build path errors that you see? Also have you tried newer eclipse? 3.4 is somewhat outdated already. – Konstantin Burov Sep 03 '10 at 02:49
  • 2
    It seems an issue with eclipse and happens in 3.5 as well on Mac. Whenever I want to build an android project I remove gen (automatically generated) folder and clean the project. – bhups Sep 03 '10 at 03:47
  • 3
    Eclipse sometimes get stuck and won't ever get rid of an error. Try deleting it from the errors tab and re-building the project. Worked for me multiple times – Austyn Mahoney Sep 03 '10 at 08:26
  • 1
    Helios Service Release 2, I just saw this after importing a project into the workspace. The "dummy library" solution was the only working solution I could find. – paiego Jul 29 '11 at 04:46
  • 1
    +1 it helped me to continue to work, after one hour of cleaning temptatives.. the simple way of adding and successively remove a dummy library, worked. – morde Jun 03 '13 at 21:56
  • This comment is almost three years after the original and I had the same problem with Eclipse Indigo after a power failure. In fact, the problem reoccurred three times after three power outages in a four hour period. Adding then removing a library entry worked every time. – user903724 Aug 08 '13 at 15:02
  • I did not add a library - at _Build Path > Order and Export_ I ticked the JRE lib - cleaned and voila! I then unticked the lib. See: http://utumno.github.io/blog/2014/05/02/eclipz/ – Mr_and_Mrs_D May 03 '14 at 00:03
  • Go to project menu, enable the build automatically and click on clean – Lova Chittumuri May 24 '17 at 08:28

20 Answers20

144

Have you tried using Project > Clean... from the menu? This will force a new build on the selected projects in Eclipse.

TK Gospodinov
  • 8,302
  • 6
  • 24
  • 25
  • i copied the installed sdk from the other system. its working fine now! – yokks Feb 02 '11 at 18:39
  • 6
    I had the same error. Eclipse had crashed and when I came back it said there was a build path error and wouldn't discuss what it was. No amount of cleaning or refreshing would fix it. This bogus "dummy library" was the only thing that worked! – JonLeah Jun 15 '11 at 16:19
  • 5
    No amount of Cleaning did it for me, tried removing/adding extra JARs as stated in other answers. Did not close Eclipse (ADT) by force, so the workspace was fine. Turns out **a simple Eclipse restart** did the trick. – cassi.lup Feb 28 '14 at 06:24
  • 1
    a simpler way, i have seen is to just do a minor change in the import order and eclipse will rebuild the build path and all errors should be resolved. – user2757415 May 06 '20 at 16:38
  • This still worked on Eclipse 2023-03, unbelievable! – le hien May 11 '23 at 03:40
66
1-Right CLick on your project folder, Choose Build Path > Configure Build Path
2-Select Libraries Tab and delete any arbitrary library present there.
3-Click on Add Library option, Select JRE System Library and click Next.
4-Choose last Radiobutton option Workspace default JRE and click Finish.
5-press f5 for refresh.
6-run ur program .
user2318214
  • 661
  • 5
  • 4
  • 1
    haha, omg this caused even more problems and errors. Now I have missing artifact org.springframework:spring-context:jar:4.3.14.RELEASE – Zack Zilic Feb 18 '18 at 00:57
11

This what fixed it for me...

I was having an issue with my spring-core.jar. I deleted the entire release directory located here. (I'm on win 10).

C:\Users********.m2\repository\org\springframework\spring-core\4.3.1.RELEASE

I right clicked on the project > Maven > Update project and my exclamation mark disappeared. No problems any more.

Here is the source where I found the information:

http://crunchify.com/cannot-be-read-or-is-not-a-valid-zip-file-how-to-fix-maven-build-path-error-with-corrupted-jar-file/

BustedSanta
  • 1,368
  • 7
  • 28
  • 55
10

This happens when libraries added to the project doesn't have the correct path.

  1. Right click on your project (from package explorer)
  2. Got build path -> configure build path
  3. Select the libraries tab
  4. Fix the path error (give the correct path) by editing jars or classes at fault
ThE uSeFuL
  • 1,456
  • 1
  • 16
  • 29
8

This works for me: close the project then re-open it, this will force eclipse to reload a fresh project and detects the correct build path.

aimhaj
  • 1,615
  • 1
  • 11
  • 16
6

None of the other answers worked for me. Even after fixing my build path issues, doing a refresh, clean, rebuild, and restart (of both eclipse and the computer), I was still getting the little red exclamation point.

I fixed it by closing the project (right-click, close project) and reopening it (double-click the closed project), which seemed to force eclipse to "notice" that the build path problems had been corrected.

Kevin Workman
  • 41,537
  • 9
  • 68
  • 107
4

For my mac osx Eclipse, I followed following steps:

  1. Right CLick on your project, Choose Build Path > Configure Build Path
  2. Select Libraries Tab and delete any arbitrary library or anything else causing errors in Build Path.
  3. Click on Add Library button, Select JRE System Library and click Next.
  4. Choose last Radiobutton option Workspace default JRE and click Finish.
  5. Clean and build your project.
NightFury
  • 13,436
  • 6
  • 71
  • 120
4

get a cmd and run

mvn eclipse:eclipse

chamzz.dot
  • 607
  • 2
  • 12
  • 24
3

This is what worked for me:

  1. Go to ~/.m2/repository and deleted everything there by running rm -rf. Make sure everything is deleted.
  2. Re-launch eclipse or STS
  3. Right click on project -> Maven -> update project.
Vikram3891
  • 713
  • 1
  • 6
  • 15
2

On my Mac this is what worked for me

  1. Project > Clean (errors and warnings will remain or increase after this)
  2. Close Eclipse
  3. Reopen Eclipse (errors show momentarily and then disappear, warnings remain)

You are good to go and can now run your project

DamongoCoder
  • 431
  • 5
  • 7
1

I've seen this problem a few times (got it again right now on my home computer with Eclipse 4.2).

Forcing a resave (by changing the classpath e.g. by adding a library, save, change-back) works temporarily. But the problem comes back when Eclipse is restarted :(

Nuking the Eclipse workspace from orbit will permanently fix it (until next time). But there must be a better way!

Daniel Winterstein
  • 2,418
  • 1
  • 29
  • 41
0

just check if any unnecessary Jars are added in your library or not. if yes, then simply remove that jars from your library and clean your project once. Its worked for me.

user3133845
  • 23
  • 1
  • 1
  • 4
0

In Eclipse this worked for me: right click project. -> Properties -> Library Section; Add (any library at all) -> select library and click remove -> press okay.

jimbob
  • 3,288
  • 11
  • 45
  • 70
0

I ran into this annoying issue with the Play framework. It would be nice if there was some way of knowing what build errors Eclipse is unhappy about, but it's not going to tell you. With one project, I was able to close the project, rebuild the Eclipse configuration with sbt eclipse, and reopen. With an almost identical project, that didn't work. But deleting the project, rebuilding the Eclipse configuration with sbt eclipse, and importing, did the trick.

cayhorstmann
  • 3,192
  • 1
  • 25
  • 17
0

If you think you've done everything correctly but Eclipse still complains about the jars, refresh the folder where the jars are and make sure eclipse knows they've been added to the project. Specifying the file path alone is (apparently) not enough

DGK
  • 2,947
  • 5
  • 32
  • 47
0

I've faced this issue a couple of times and following the below steps has resolved both the times. 1. Navigate to C:\Users\ 2. locate the ".m2" folder and delete it.

  1. Now navigate to the particular project in eclipse and Right-click on the project > Maven > Update Project

wait until the project is updated and in my case following the above steps resolved both the times.

knsaicharan
  • 115
  • 1
  • 11
0

I was getting an additional warning

The compiler compliance specified is 1.6 but a JRE 1.8 is used

Resolving this warning make the error also go away. The steps are as follows:

I right-clicked on it, then clicked on Quick Fix. From the dialog that opened I selected Open the Compiler Compliance property page, and clicked the Finish button.

(This is same as Java Compiler section.)

In this dialog I found the Compiler compliance level drop down and changed 1.6 to 1.8, and clicked on Apply and close.

I got a message box Compiler Settings Changed which asked if I wanted to Build the project now?. I clicked on Yes.

The build path error went away.

Kinjal Dixit
  • 7,777
  • 2
  • 59
  • 68
0

Go to > Right CLick on your project folder > Build Path > Configure Build Path > Libraries Tab > remove project and external dependencies > apply & close

Now, Gradle refresh your project.

saurabh gupta
  • 491
  • 6
  • 18
0
Added below to pom.xml file and it worked eventually: 

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.0</version>
    <scope>provided</scope>
</dependency>
appdesigns
  • 114
  • 1
  • 11
-1

Goto to Project=>Build Automatically . Make sure it is ticked

HimalayanCoder
  • 9,630
  • 6
  • 59
  • 60