简体   繁体   中英

Syntax Error Eclipse in R.java

I am getting this error:

Description Resource    Path    Location    Type
Syntax error on token "Home", delete this token R.java  /UCCPocketCoach/gen/androidapp/fyp/uccpocketcoach   line 1659   Java Problem


public static final int btn Home=0x7f060062;

I have no idea where this button is and how to change it, I have tried deleting the token but it regenerates and I have no idea where it is referenced in my code or how to fix it. I have tried joining the space from btn to Home but did not work

Please help

The R,java is auto generated.In case there are error in R.java delete the file and build your project again. In case the file is not auto generated try checking your res files for errors.These errors are shown in console in eclipse.

Don't edit inside the R.java file. If needed you can delete the whole gen folder,clean and rebuild.

Please share your xml file too.

May be your project contains the file, that file name contains with "-" (subtraction).

Or check attributes in your xml file. If your xml file contains, id with subtraction remove the subtraction.

ex:

Change button-gackground.xml to button_gackground.xml

Or

Change

<Button
        Android: id="@+id/btn-home"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Home Button" />

to

<Button
        android:id="@+id/btn_home"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Home Button" />


Then clean and build the project. If the problem is subtraction. Your project will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM