Eclipse 不生成 R.java 和 gen 文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16774201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse doesn't generate R.java and gen folder
提问by GuilhE
I had to share this problem with you 'cause I lost an entirely morning around this. So what was my problem? Suddenly Eclipse refuses to generate R.java and create gen folder. I've tried all kind of solutions I came across in stackoverflow and some blogs:
我不得不和你分享这个问题,因为我整个上午都在这件事上失去了。那么我的问题是什么?突然 Eclipse 拒绝生成 R.java 并创建 gen 文件夹。我已经尝试了在 stackoverflow 和一些博客中遇到的各种解决方案:
- Clean Project and Rebuild
- Clean Project with Build Automatically off and then Rebuild
- Create the gen folder
- Create gen folder with a R.java dummy
- Copy the gen folder from that project used in another project (different workspaces)
- Validate all my .xml files
- 清理项目和重建
- 关闭自动构建的清理项目,然后重新构建
- 创建 gen 文件夹
- 使用 R.java 虚拟创建 gen 文件夹
- 从另一个项目(不同的工作区)中使用的该项目复制 gen 文件夹
- 验证我所有的 .xml 文件
Nothing worked... So, what was the solution? I'll answer myself.
没有任何效果......那么,解决方案是什么?我自己来回答。
回答by GuilhE
Checking the SDK Manager worked for me. It seems Android Build Tools went missing :/
Strange behaviour from eclipse...
检查 SDK 管理器对我有用。似乎 Android 构建工具丢失了:/
来自 Eclipse 的奇怪行为......
After installing it everything worked as expected. So here's another solution...
安装后一切都按预期工作。所以这是另一个解决方案......
Hope it works for you,
Take care.
希望它对你
有用,保重。
回答by shift66
I spent on this about an hour... In my case it was because of a file in drawables containing -
.
我花了大约一个小时...在我的情况下,这是因为 drawables 中的一个文件包含-
.
Eclipse can't mark your files with wrong characters.
Eclipse 无法用错误的字符标记您的文件。
check your drawable folders and files in them. Also you can check another folders with resources or something like that. This problem can be caused by wrong (unsupported) characters in some file names.
检查其中的可绘制文件夹和文件。您也可以使用资源或类似内容检查另一个文件夹。此问题可能是由某些文件名中的错误(不受支持)字符引起的。