简体   繁体   中英

wamy project's R.java file is causing and error and when ever i fix it eclipse removes the changes i made

this is causing the error

        public static final class id {
        public static final int timeToSend=0x7f080021;
        public static final int timeToSend,=0x7f080023;
        }

whenever I remove the second and save the file eclipse changes it back. I tried changing it while eclipse is not running and yet when I opened eclipse it changed the file back. I don't have any duplicates in layout to cause the problem. I tried cleaning the project and it didn't work. turns out I wrote android:layout_alignBottom="@+id/timeToSend," instead of android:layout_alignBottom="@+id/timeToSend" that's why it nade a duplicate with the comma. sorry for the trouble

也许是因为您有一个带有android:id="@+id/timeToSend,"的XML元素?

Android ID's cannot have any special characters in them. So android:id="@+id/timeToSend, would be wrong due to the fact that it has a comma. All you have to do is find that ID and rename it.

It's not recommended to edit the R.java file because it generates itself based on all the ID's you have created. The only way to edit it is to get rid of the ID's that you have declared in XML, otherwise, every time you clean the project, they regenerate.

Something that I always try when R.java is giving me problems is rebuilding the project.

You should be able to find the option under Project and then Clean . That's only if rebuilding it hasn't worked.

Good luck and I hope this helps!

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