开发者

Error i R.java: "Syntax error on token 'int', VariableDeclaratorId expected after this token"

开发者 https://www.devze.com 2023-03-31 12:25 出处:网络
This morning when I opened up Eclipse to work on an Android project I got an error inside the R.java file.

This morning when I opened up Eclipse to work on an Android project I got an error inside the R.java file.

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开发者_Go百科 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.

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


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.


Most probably, u have an empty string in your strings.xml

<string name=""></string>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号