消失的R.class-Android应用程序开发

消失的R.class-Android应用程序开发,android,performance,android-resources,Android,Performance,Android Resources,由于styles.xml中的一些问题,我正在努力使R.class消失——它说 Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. 将项目导出到另一台笔记本电脑时出现问题 下面是styles.xml 提前谢谢 <resources> <!-- Base application theme, dependent

由于styles.xml中的一些问题,我正在努力使R.class消失——它说

Error retrieving parent for item: 
No resource found that matches the given name 'Theme.AppCompat.Light'.
将项目导出到另一台笔记本电脑时出现问题

下面是styles.xml

提前谢谢

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

这意味着您在新机器的生成路径中没有支持库。请参阅文档部分以获取答案。

首先,我想您尝试了Project->Clean或关闭并重新打开eclipse本身。然后,您必须确保如前所述添加支持库。

缺少R文件可能是由多种原因造成的。 可能的解决方案 溶胶1。由于它与支持库中定义的Theme.AppCompat.Light关联,因此可能是由于生成路径AppCompat中缺少支持库所致。 溶胶2。检查appcompat的版本并确保您拥有最新版本。 溶胶3。只是想确定一下。撤消在任何xml文件中所做的最新更改,或从历史记录中替换xml文件。 溶胶4。如果您已经添加了支持库,但问题仍然存在,那么请从lib文件夹中删除android-support-v4.jar(如果存在),这是因为冲突的支持jar文件可能会导致R文件错误。 溶胶5。检查项目构建目标。项目>属性>Android

您还可以通过将光标放在textTheme.AppCompat.Light之间并按下控制按钮(该按钮应在整个文本下划线),确保支持库中存在“Theme.AppCompat.Light”


我希望这有帮助

我不知道你为什么对Theme.AppCompat.Light有这样的问题,可能是因为你忘记了导入任何兼容库。无论如何,如果您在文件夹res resources中的任何文件中都有错误,编译将无法工作,并且可能不会创建R.class。请遵循Little Child的说明。我也非常确定,您的问题与您应该包含在项目中的兼容性库有关。如果有帮助,请记下我的评论。谢谢