2010-07-08 20 views
5

I stworzył świat aplikację Witaj jednak uzyskać ten dziwny błąd:Eclipse - HelloWorld - błąd Androida?

The project cannot be built until the build path errors are resolved 

Nie zmienił projekt, jut stworzył go i starał się go uruchomić.

+1

Uruchomiłem ponownie IDE i działa teraz .... Nic nie dotykałem. –

+0

dobry punkt. Zaktualizowałem swoją odpowiedź, aby uwzględnić ten proces. – VonC

Odpowiedz

2

aby uniknąć tego przykry problem mam 3 rozwiązania, które sprawdziły się u mnie.

Rozwiązanie 1)

delete your generated R.java file inside your gen/ folder

Rozwiązanie 2)

a)Delete your project from Eclipse (i said ONLY from Eclipse, uncheck option: Delete project contents on disk)

b) import your project to Eclipse: file > Import > Existing Projects into Workspace (Look for your project previously deleted from Eclipse) > Finish.

Rozwiązanie 3)

make Solution 1 then Solution 2

1

Wygląda na to, że brakuje importu lub słoika. W twoim projekcie w eksploratorze projektu powinno być czerwone x na ikonie pliku, która zawiera błąd.

2

To jest albo fałszywa wiadomość można rozwiązać przez forcing Eclipse to recompute its library paths

I found the resolution for this at Scott D. Strader's blog .
To summarize the solution I only needed to add a library to my project and then remove it to force Eclipse to perform the necessary actions to resolve the problem. I would post the detailed steps here but I don't want to steal his content.

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

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

UWAGA: PO wymienia prosty restart IDE może być wystarczająco.


Albo rzeczywiście brakuje jednego krytycznego bibliotekę like a JRE library:

I needed to add the JRE library to the project for it to run. Not sure if this was due to the updated version or something else…. Any way this fixed the issue:

  • Project > Properties
  • Java Build Path
  • Libraries tab
  • Click add library
  • Select JRE System Library
  • Next
  • Finish
1

Oprócz wymienionych odpowiedzi, istnieje jeszcze jeden scenariusz Widziałem ten błąd przy użyciu próbki projektów ujętych z pojawiać Android SDK. Z jakiegoś powodu wygenerowany plik R.java może być nieprawidłowy lub uszkodzony. Możesz obejść go, rozwijając folder "gen" w Eksploratorze pakietów i usuwając plik R.java. Natychmiast zostanie zregenerowany i błąd zniknie.

1

prawym przyciskiem myszy na projekcie, wybierz „Build Path”, „Configure Build Path” -> i wybierz Android 2.2 lub że cel został podany podczas tworzenia projektu

0

miałem podobne problemy. dla mnie po prostu zamykanie emulatora i ponowne uruchamianie prac projektu