eclipse no reconoce la identificación o el archivo [duplicado]

Posible duplicado:
R no se puede resolver - error de Android

The errors I have are on line 18 and 19. It does not recognize the id iv1 but that id is in my main.xml file. Also does not recognize the logo_animation which is an xml file and is spelled correctly. Anyone know why this is?

package graphics.examples;

import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageView;

public class graphics extends Activity {

AnimationDrawable logoAnimation;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

    ImageView logoImage = (ImageView) findViewById(;
    logoAnimation = (AnimationDrawable) logoImage.getBackground();

public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN){
        return true;
    else return super.onTouchEvent(event);

preguntado el 08 de noviembre de 11 a las 13:11

4 Respuestas

It doesn't look like you're importing R. When you add it, make sure you're importing your R file and not android.R

respondido 08 nov., 11:17

Do you have invalid XML in some of your files or have you entered ID's in wrong order? Try to remove highlited text/xml in your xml-files and insert them back again and then rebuild the project. I got this problem when I added references to elements/id's in my xml-files that didnt exist yet and when I added the missing elements/id's it still didnt recognize it. So sometimes eclipse is stupid.

respondido 08 nov., 11:17

This some times happen because the project was no built, either because you have an error or because you disable automatically build. Only when you built your project the R class is created.

But viewing you code it seems you are missing the import of R package for your project.

It should be something like import graphics.examples.R;

But if you are using eclipse just pass the mouse over the and eclipse will show a list of possible imports and choose your package

respondido 08 nov., 11:17

I run across this problem when there is an error in one of my resource files (layout, drawable, menu). Make sure that you do not have any strings used in the resource files and not declared in the string.xml. I have also had to delete my and when it is recreated the id has been recognized.

respondido 08 nov., 11:18

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.