Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

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 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

like image 552
Darwind Avatar asked Aug 30 '11 08:08

Darwind


2 Answers

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.

like image 161
Ollie C Avatar answered Nov 17 '22 02:11

Ollie C


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

<string name=""></string>
like image 42
vintuwei Avatar answered Nov 17 '22 01:11

vintuwei