简体   繁体   中英

android eclipse problem with R.java

Suddenly my Android app is compiling with loads of errors in Eclipse. When I use Project-Clean the console shows it processing until 'Writing symbols for class R' then it pauses for around a minute and finishes with 'Nothing to pre compile' This behaviour follows adding several new strings to my strings.xml and replacing strings in the code with :-

getResources().getString(R.string.name of string);

Any ideas? Would it be safe to delete the R.java file to force it to rebuild perhaps?

I faced a similar issue. I had missed putting a plus sign in android:id="@+id/GoTo". Everything was fine after I put back the missing plus sign, cleaned and rebuilt the project.

Check if you import the right R file. It should be your projects file, not android.R .

Maybe your listing is not exact code but if it is, then resources names can't contain spaces. (I am talking about R.string.name of string )

当您在strings.xml中更改某些内容以保存该文件并重新构建后,当您使用eclipse时非常重要!如果您选中了自动构建选项,那么如果不选择CTRL + S就足够了,那么必须手动重新构建您的R.strings值未进行喷射更新

This is my currently todo list when I have that kind of problem:

  1. Refresh main project
  2. Clean
  3. Build All

if it wont work again. Close Eclipse -> repeat from 1.

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