3

我正在创建一个 android 应用程序,当更改一些代码并运行它时,我被告知应用程序的 R.Java 文件中存在错误。我不知道这个错误来自哪里,我似乎无法修改它。

R.Java 中的代码是

public final class R {
    public static final class array {
    public static final int races_array=0x7f040000;
}
public static final class attr {
}
public static final class drawable {
    public static final int icon=0x7f020000;
    public static final int logo=0x7f020001;
}
public static final class id {
    public static final int 1=0x7f060007;//this line has the error 
    public static final int BMI=0x7f06001f;
    public static final int Cdate=0x7f060005;
    public static final int Current=0x7f060006;
    public static final int Days=0x7f06001e;
    public static final int activity=0x7f06001b;
    public static final int advice=0x7f060004;
    public static final int cals=0x7f060022;
    public static final int cheight=0x7f060013;
    public static final int choice=0x7f060019;
    public static final int code=0x7f06001d;
    public static final int cweight=0x7f06000a;
    public static final int date=0x7f060020;
    public static final int dateDisplay=0x7f060008;
    public static final int details=0x7f06001c;
    public static final int eheight=0x7f060011;
    public static final int eweight=0x7f060012;
    public static final int get=0x7f06000d;
    public static final int goal=0x7f060025;
    public static final int group=0x7f060023;
    public static final int newheight=0x7f060017;
    public static final int newweight=0x7f060016;
    public static final int nweight=0x7f06000c;
    public static final int out=0x7f06000e;
    public static final int out_text=0x7f060002;
    public static final int pass=0x7f060018;
    public static final int pickDate=0x7f060009;
    public static final int progress=0x7f06001a;
    public static final int start=0x7f060003;
    public static final int step=0x7f060001;
    public static final int steps=0x7f060021;
    public static final int t1=0x7f06000f;
    public static final int t2=0x7f060010;
    public static final int textView1=0x7f06000b;
    public static final int textView2=0x7f060024;
    public static final int textView3=0x7f060014;
    public static final int textView4=0x7f060015;
    public static final int tv=0x7f060000;
}
public static final class layout {
    public static final int activity=0x7f030000;
    public static final int advice=0x7f030001;
    public static final int choice=0x7f030002;
    public static final int convert=0x7f030003;
    public static final int main=0x7f030004;
    public static final int notes_row=0x7f030005;
    public static final int progress=0x7f030006;
    public static final int splash=0x7f030007;
}
    public static final class string {
        public static final int app_name=0x7f050001;
        public static final int hello=0x7f050000;
        public static final int race_elf=0x7f050003;
        public static final int race_goblin=0x7f050007;
        public static final int race_halfling=0x7f050006;
        public static final int race_human=0x7f050005;
        public static final int race_orc=0x7f050002;
        public static final int race_troll=0x7f050004;
    }
}

我不知道这是否对任何人有帮助,但我只想知道是什么造成了这个错误以及如何解决它。

4

1 回答 1

9

您在某处定义为 id @+id/11不会生成有效的 Java 标识符,因此会出现错误。出于同样的原因,不能创建名称以数字开头、包含空格或与保留关键字匹配的 ID 或资源。

于 2012-05-26T23:53:58.287 回答