错误生成R.java drawables

时间:2014-05-28 17:12:06

标签: java android xml resources r.java-file

Heyho,

我有关于R.java文件的问题。实际上我通过在所有可绘制文件夹(mdpi,hdpi,...)中创建一个名为“ic_tab_debate.png”的可绘制图标来创建它,还在可绘制文件夹中创建名为“ic_tab_debate.xml”的XML文件。这当然导致了这个问题。但删除XML文件后,R.java仍然出现问题!

R.java文件的可绘制部分如下所示:

public static final class drawable {
    public static final int =0x7f020022; //Here is the problem
    public static final int common_signin_btn_icon_dark=0x7f020000;
    public static final int common_signin_btn_icon_disabled_dark=0x7f020001;
    public static final int common_signin_btn_icon_disabled_focus_dark=0x7f020002;
    public static final int common_signin_btn_icon_disabled_focus_light=0x7f020003;
    public static final int common_signin_btn_icon_disabled_light=0x7f020004;
    public static final int common_signin_btn_icon_focus_dark=0x7f020005;
    public static final int common_signin_btn_icon_focus_light=0x7f020006;
    public static final int common_signin_btn_icon_light=0x7f020007;
    public static final int common_signin_btn_icon_normal_dark=0x7f020008;
    public static final int common_signin_btn_icon_normal_light=0x7f020009;
    public static final int common_signin_btn_icon_pressed_dark=0x7f02000a;
    public static final int common_signin_btn_icon_pressed_light=0x7f02000b;
    public static final int common_signin_btn_text_dark=0x7f02000c;
    public static final int common_signin_btn_text_disabled_dark=0x7f02000d;
    public static final int common_signin_btn_text_disabled_focus_dark=0x7f02000e;
    public static final int common_signin_btn_text_disabled_focus_light=0x7f02000f;
    public static final int common_signin_btn_text_disabled_light=0x7f020010;
    public static final int common_signin_btn_text_focus_dark=0x7f020011;
    public static final int common_signin_btn_text_focus_light=0x7f020012;
    public static final int common_signin_btn_text_light=0x7f020013;
    public static final int common_signin_btn_text_normal_dark=0x7f020014;
    public static final int common_signin_btn_text_normal_light=0x7f020015;
    public static final int common_signin_btn_text_pressed_dark=0x7f020016;
    public static final int common_signin_btn_text_pressed_light=0x7f020017;
    public static final int ic_launcher=0x7f020018;
    public static final int ic_launcher_sw=0x7f020019;.......

但是,删除R.java文件并清理项目并没有解决我的问题。错误的R.java总是被重新生成。有一个没有名称的资源,但我不知道如何删除它= 0x7f020022。

感谢您提前帮助:)

2 个答案:

答案 0 :(得分:0)

delet R.java并重启eclipse 确保drawables文件不是大写字母

答案 1 :(得分:0)

感谢您的支持!我终于找到了我的问题的解决方案!之后我可以说,这只是一个小而愚蠢的错误,但当我问它时,我发疯了。 实际上这是一个只会发生在德国人身上的错误。我认为问题是由于具有相同名称的文件。但之前我添加了另一个名为'ic_tab_hlü.png'的文件。德语变异元音ü不允许资源。这就是R.java文件无法正确生成的原因! 因此删除bin文件夹或R.java文件没有改变任何东西,因为问题的根没有被剪切,文件被重新生成错误。

但是,非常感谢帮助我。我将来只会尝试使用英文文件名:)