R.Java没有生成 [英] R.Java not generated

查看:141
本文介绍了R.Java没有生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已从 Google代码下载代码,但是当我将该项目导入我的eclipse IDE
它不会生成R.Java文件。我搜索了许多博客和论坛,并尝试过许多事情,如清理,重建,从现有的源代码创建项目,但仍然面临着这个问题。有人提到有时是由SVN客户端软件造成的,但是没有人提到任何解决方案。如果您自己下载并找到确切的问题,我将非常感谢你们。

解决方案

一般来说,让它工作:


  1. 将项目导入eclipse(File - >导入 - >常规 - >现有项目进入工作区)

  2. 在Eclipse中,手动创建gen文件夹并将其添加为源文件夹(右键单击项目,构建路径 - >配置构建路径 - >添加文件夹)

  3. 清理你的项目,你假设得到R.java生成

但是它不,为什么?



因为在res中有一些关于xml文件的编译错误(或错误),所以R不是genetared(我在Mac上测试过):

在res / values / styles .xml:注释掉以下内容:

 < style name =iWindowTitleBackgroundparent =android:WindowTitleBackground> 
< item name =android:background> @ drawable / title_bar< / item>
< / style>

在res / values / themes.xml中:注释掉以下内容:

 < item name =android:windowTitleBackgroundStyle> @ style / iWindowTitleBackground< / item> 

然后做一个Project - > Clean,你应该得到R.java生成。



有一个bug报告说,在一些操作系统中,parent =android:WindowTitleBackground无法解析,请查看这里了解更多详情。


I have downloaded code from google codes but when I import that project in my eclipse IDE it does not generate R.Java file.I searched many blogs and forums and tried many things like cleaning ,rebuilding, creating project from existing source etc but still facing the problem.Some people mentioned that it is sometimes caused by the SVN client software,but none of them mentioned any solution for that.I will be very thankful to you guys if you download it yourself and find what is the exact problem.

解决方案

In general, to make it work:

  1. import project into eclipse (File -> Import -> General -> Existing Projects into Workspace)
  2. in Eclipse, Manually create gen folder and add it as source folder (right click on your project, Build Path -> Configure Build Path -> Add folder)
  3. Clean your project, you suppose to get R.java generated

But It doesn't, Why?

Because there are some compile error (or bug?) regarding to the xml file in res, so R is not genetared (I've tested on my Mac):
In res/values/styles.xml: commented out the following:

<style name="iWindowTitleBackground" parent="android:WindowTitleBackground">    
  <item name="android:background">@drawable/title_bar</item>        
</style>

In res/values/themes.xml: comment out the following:

<item name="android:windowTitleBackgroundStyle">@style/iWindowTitleBackground</item>

Then do a Project -> Clean, you should get R.java generated.

There is bug reported that parent="android:WindowTitleBackground" cannot be resolved in some operating system, check out here for more details.

这篇关于R.Java没有生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆