2010-07-08 11 views
5

he creado una aplicación Hola mundo pero conseguir este extraño error:Eclipse - HelloWorld - ¿Error de Android?

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

no he cambiado el proyecto, se sobresalen creado y trató de ejecutarlo.

+1

He reiniciado el IDE y funciona ahora ... Aunque no toqué nada. –

+0

buen punto. He actualizado mi respuesta para incluir ese proceso. – VonC

Respuesta

2

para evitar el molesto problema que tengo 3 soluciones que funcionaron para mí

Solución 1)

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

Solución 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.

Solución 3)

make Solution 1 then Solution 2

1

Parece que se está perdiendo una importación o jar. En su proyecto en el explorador del proyecto, debe haber una x roja en el ícono del archivo que contiene el error.

2

O bien es un mensaje espuria puede resolver por 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: como el OP menciona, un simple reinicio del IDE puede ser suficiente.


O en realidad se olvida de uno biblioteca crítico 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

Además de las respuestas mencionadas, hay otro escenario que he visto aparecer este error cuando se utiliza la muestra de los proyectos incluidos en el Android SDK. Por algún motivo, el archivo R.java generado puede no ser válido o estar dañado. Puede evitarlo expandiendo la carpeta "gen" en el Explorador de paquetes y eliminando el archivo R.java. Inmediatamente se regenerará y el error desaparecerá.

1

Haga clic derecho sobre su proyecto, elija "Vía de construcción", "Configurar Vía de construcción" -> y elegir Android 2.2, o ese objetivo especificada cuando se creó el proyecto

0

he tenido problemas similares. para mí, simplemente cerrando el emulador y volviendo a ejecutar el proyecto funciona