简体   繁体   中英

R.java doesn't exist…but it does! Problem started after installing ADT 10.0.0

I get this error when I try to clean a project: ERROR: Unable to open class file ....R.java: No such file or directory

So I can't build my projects any more. But R.java is there in the gen folder and looks fine when I open it.

This happens to every one of my projects. I tried completely deleting the Eclipse folder and reinstalling it (Helios on Windows) and Android ADT. No luck.

I have also tried moving my workspace to a different drive. No luck.

I made sure all folders in my workspace are not read only. This worked the first time, but immediately the error came back when I cleaned my project.

This all started right after installing ADT 10.0. I am wondering if it somehow is building R.java as a read-only file.

EDIT: Is deleting the eclipse directory sufficient to reset all of its configuration?

More info: All my projects are fine, until I rebuild or clean them. Then every class that looks at R.java throws an error.

您是否尝试删除“ bin”和“ gen”文件夹,然后进行清理/构建?

I have somehow managed to fix it, but I don't know exactly what did it. Here are things I did.

  • Deleted eclipse directory and reinstalled it and ADT.
  • Deleted my original project that was the first to have the problem.'
  • Created a new project with my original's project name.
  • Manually copied all my class and res files into the new project and refreshed it.
  • Pasted the text of the old manifest into the new manifest.

I did all this, because simply importing the original project again didn't solve anything.

After the above changes, my other projects still had the problem after pressing clean on them. But then I could fix those by deleting the Gen folder, and making sure the Java Build Path had all folders checked.

I think format C: and reinstalling windows
will be preferred way to solve this issue :)
now for serious that work for me
install all updates restart eclipse and close your project
restart eclipse and delete gen from eclipse and rebuild your project

Helo guys,

:) This my solution which work for me fine in eclipse.
You need to make a copy of the file who make the problem. 您需要复制造成问题的文件。
delete this file from eclipse 从eclipse中删除此文件
Project >clean 项目>清洁
After you can restart your delted file from the location where you have saved it.

Have a nice day

I found this issue reported for Mac:

But it's the same for Windows, and I guess, for Linux. I've posted there a workaround, very similar to the one by TenFour04, but without the need to reinstall anything:

  1. Delete project from Eclipse;
  2. Delete all project generated and configuration files and folders (bin, gen, .classpath, .project, default.properties);
  3. Go to Eclipse and create a new Android Project (do not import an existing one) choosing your original source files;
  4. Adjust all setting (JRE, libraries, linked files, aspects, etc...)
  5. Clean.

if you're having the problem for all of your projects, it could be this:

"Debug certificate expired" error in Eclipse Android plugins

that's what fixed it for me, even though I wasn't getting any debug certificate errors. apparently the debug certificate is only valid for one year.

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