Ernesto Delgado Ernesto Delgado - 1 month ago 6x
Android Question

R file is missing android

i was using Eclipse Helios but due to performance issues i changed to Eclipse Galileo and installed the ADT plugging, and added my sdk folder to Elcipse Preferences. Now disappeared from all of my projects. How can i fix this, i did Project/Clean but that won't generate the files, there's nothing wrong in my xml and there's no out.xml in any of my projects.

Thanks in advance


I had this same issue today and figured it out. The reason this happens so often when including external/example files is because often times these examples reference layouts in your application, but do not have access to the package and therefore cannot see the file in that package. to make things clear, here's the beginning of the file:

 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.

package com.conceptualsystems.dashboard;

public final class R {
    public static final class attr {
    public static final class drawable {
        public static final int csc_logo=0x7f020000;
        public static final int icon=0x7f020001;
    public static final class id {
        public static final int activation_code=0x7f070012;
        public static final int alpha_bar=0x7f07000b;
        public static final int alpha_label=0x7f07000a;

notice the package name is whatever the package name of your application is. .java files that are not included in this package (ie, your example code you just dropped in) will need to explicitly reference that package file like this:


import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.SeekBar;
import com.conceptualsystems.dashboard.R;

the last line is the one to pay attention to. after importing the resources explicitly, the resources will be available in your example code.