Android:导入v7 appcompat后R的问题 [英] Android: Issues with R after importing v7 appcompat

查看:194
本文介绍了Android:导入v7 appcompat后R的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 android开发者网站,并遇到了许多其他用户遇到的缺少的R问题。我已阅读几个类似的疑问用户这里,并尝试了建议,但我仍然得到缺少的R问题。我重新导入了appcompat库,清理了我的项目,重新启动了eclipse,在清单和属性中更改了我的最小和目标SDK,并且仍然有同样的问题。关于R的确切错误是R无法解析为变量。

I imported the v7-appcompat support library following the instructions on the android developer site, and ran into the missing R issue that many other users have encountered. I've read through several similar questions users have posted here, and tried what was suggested but I'm still getting the missing R problem. I've re-imported the appcompat library, cleaned my project, restarted eclipse, changed my min and target SDK in both the manifest and properties, and still have the same issue. The exact error regarding R is "R cannot be resolved to a variable".

另外,值文件夹中的attrs xml文件还有一个错误,当我发生添加了图书馆,但没有人提到。这是文件中的代码:

Also, the attrs xml file in the values folder has an error that also showed up when I added the library but nobody else has mentioned. This is the code in the file:

<declare-styleable name="ButtonBarContainerTheme">
    <attr name="buttonBarStyle" format="reference" />
    <attr name="buttonBarButtonStyle" format="reference" />
</declare-styleable>

Eclipse给我的错误是error:AttributebuttonBarStyle已经定义。任何帮助,将不胜感激!

The error Eclipse is giving me is "error: Attribute 'buttonBarStyle' has already been defined". Any help with this would be greatly appreciated!

推荐答案

听起来像您的风格在您的项目RES文件夹中定义。那个风格也在v7支持库中定义,所以现在定义了两次。从您的RES xml中删除它。

It sounds like your styleable is defined in your project RES folder. That styleable is also defined in the v7 support library, so it is now defined twice. Remove it from your RES xml.

看到这篇文章:在Android Studio中添加全屏活动后构建错误

这篇关于Android:导入v7 appcompat后R的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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