2010-07-08 18 views
5

Ho creato un mondo di app Ciao, ma ottenere questo strano errore:Eclipse - HelloWorld - Errore Android?

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

Non ho cambiato il progetto, jut creato e provato a farlo funzionare.

+1

Ho riavviato l'IDE e funziona ora .... Non ho toccato nulla però. –

+0

buon punto. Ho aggiornato la mia risposta per includere tale processo. – VonC

risposta

2

per evitare che fastidioso problema ho 3 soluzioni che hanno funzionato per me.

Soluzione 1)

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

Soluzione 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.

Soluzione 3)

make Solution 1 then Solution 2

1

Sembra che manchi un'importazione o un contenitore. Nel tuo progetto nel progetto di esplorazione dovrebbe esserci una x rossa sull'icona del file che contiene l'errore.

2

Si tratta di un messaggio sia spurio è possibile risolvere da 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

Nota: come l'OP menziona, un semplice riavvio del IDE può essere sufficiente.


Oppure in realtà manca una libreria critica 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

Oltre alle risposte elencate, c'è un altro scenario che ho visto questo errore viene visualizzato quando si utilizza il campione di progetti inclusi con il SDK Android. Per qualche motivo, il file R.java generato può essere non valido o corrotto. È possibile aggirare il problema espandendo la cartella "gen" in Esplora pacchetti e cancellando il file R.java. Verrà immediatamente rigenerato e l'errore scompare.

1

Fare clic destro sul progetto, scegliere "Build Path", "Configure Build Path" -> e scegli Android 2.2, o che l'obiettivo è stato specificato quando è stato creato il progetto

0

Ho avuto problemi simili. per me semplicemente chiudendo l'emulatore e rieseguendo il progetto funziona

Problemi correlati