This morning when I opened up Eclipse to work on an Android project I got an error inside the R.java file.
今天早上,当我打开Eclipse,在一个Android项目上工作时,我在R中发现了一个错误。java文件。
I know what the error is, but I can't seem to grasp how to fix it ;\
我知道这个错误是什么,但我似乎不知道怎么解决它。
The code where the error is:
错误所在的代码:
public static final class string {
public static final int =0x7f040010;
public static final int app_name=0x7f040000;
As you can see, the first field doesn't have a name and that gives an error of course.
正如您所看到的,第一个字段没有名称,这当然会出错。
Problem is when I delete the file and it's auto generated again, the error is still there. If I try to manually change or delete the field it doesn't help. Still an error.
问题是,当我删除文件时,它自动生成,错误仍然存在。如果我尝试手动更改或删除该字段,它不会有帮助。还是一个错误。
Tried to restart Eclipse - no difference. Tried to clean up the project and I've tried to "fix project properties" from the Android tools menu.
试图重新启动Eclipse——没有区别。试图清理这个项目,我尝试从Android工具菜单中“修复项目属性”。
Anyone? It's really annoying as I can't continue with my project. I might have to delete the project and copy the classes, xml and drawables, but I'd rather not - hate doing cumbersome work :S
有人知道吗?这真的很烦人,因为我不能继续我的项目了。我可能不得不删除项目并复制类、xml和drawables,但我不想——讨厌做繁琐的工作:S。
2 个解决方案
#1
16
The problem is most likely with the strings.xml file. When you build the project that file is compiled into the R.java resources class. So check your strings.xml file carefully and as there is most likely an issue there that is causing this compilation error.
问题很可能是字符串。xml文件。当您构建将文件编译成R的项目时。java资源类。检查你的字符串。xml文件很仔细,因为很可能有一个问题导致了这个编译错误。
#2
3
Most probably, u have an empty string in your strings.xml
很可能,您的字符串中有一个空字符串。
<string name=""></string>
#1
16
The problem is most likely with the strings.xml file. When you build the project that file is compiled into the R.java resources class. So check your strings.xml file carefully and as there is most likely an issue there that is causing this compilation error.
问题很可能是字符串。xml文件。当您构建将文件编译成R的项目时。java资源类。检查你的字符串。xml文件很仔细,因为很可能有一个问题导致了这个编译错误。
#2
3
Most probably, u have an empty string in your strings.xml
很可能,您的字符串中有一个空字符串。
<string name=""></string>