加入全屏活动Android的工作室后,生成错误 [英] Build errors after adding fullscreen activity in Android Studio

查看:198
本文介绍了加入全屏活动Android的工作室后,生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用我的第一次的Hello World般的机器人Studio应用程序。我试图添加一个新的活动(首先通过新建 - > Android的组件,不喜欢的结果,删除它,然后通过新建 - >活动 - >选择全屏活动)。现在,我得到这些错误:

I'm experimenting with my first "Hello World"-like application in Android Studio. I've tried to add a new activity (first via New -> Android Component, didn't like the result, deleted it, then via New -> Activity -> selected Fullscreen activity). Now I get these errors:

  Gradle: Execution failed for task ':LanguagesMemorizer:processDebugResources'.
  > Could not call IncrementalTask.taskAction() on task ':LanguagesMemorizer:processDebugResources'
  C:\...\src\main\res\values\attrs.xml
    Gradle: Attribute "buttonBarStyle" has already been defined
    Gradle: Attribute "buttonBarButtonStyle" has already been defined

我试着在我的项目寻找buttonBarStyle。它被发现在:

I've tried searching for buttonBarStyle in my project. It was found in:

  • 建立文件夹(我想我应该忽略,不应该吗?)
  • 新的活动布局文件(样式=?buttonBarStyle)
  • 在值\ attrs.xml本身(<申报,设置样式...>< attr指示NAME =buttonBarStyle格式=参考/> ...
  • 在值\ styles.xml(<风格...> ...<项目名称=buttonBarStyle> @风格/按钮栏< /项目> ...
  • 值-V11 \ styles.xml(<风格...> ...<项目名称=buttonBarStyle>安卓?ATTR / buttonBarStyle< /项目> ..
  • build folder (I guess I should ignore that, shouldn't I?)
  • layout file for a new activity (style="?buttonBarStyle")
  • values\attrs.xml itself (<declare-styleable ...> <attr name="buttonBarStyle" format="reference" /> ...)
  • values\styles.xml (<style...>... <item name="buttonBarStyle">@style/ButtonBar</item>...)
  • values-v11\styles.xml (<style...>...<item name="buttonBarStyle">?android:attr/buttonBarStyle</item>...)

所有的它是自动生成的。我应该如何解决这个问题?

All of it was auto-generated. How should I fix this error?

更新:有一个在attrs.xml评论它说

UPDATE: There is a comment in attrs.xml which says

<!-- Declare custom theme attributes that allow changing which styles are
         used for button bars depending on the API level.
         ?android:attr/buttonBarStyle is new as of API 11 so this is
         necessary to support previous API levels. -->

所以好像都需要老机器人这些属性,但所以我想有某种API 11-声明的属性和这些手动属性之间存在冲突。我应该如何解决这些问题?

So it seems like these attributes are needed for old Androids, but so I guess there is some sort of a conflict between API 11-declared attributes and these manual attributes. How should I fix them?

推荐答案

这是因为 com.android.support:appcompat-v7:18.0.0 已经有这个属性。所以,如果你打算使用此支持库(你应该)是安全的只是删除声明此属性从项目的\ src \主\水库\值\ attrs.xml 。我想,这样的重复是因为AndroidStudio新的活动向导,不设,您可以使用支持库,所以它本身产生的所有code。

This is because com.android.support:appcompat-v7:18.0.0 already has this attribute. So if you plan to use this support library (and you should) it is safe to just delete declaration of this attributes from your project \src\main\res\values\attrs.xml. I guess, this duplication is because AndroidStudio new activity wizard, doesn't suppose that you can use support library so it generates all code by itself.

这篇关于加入全屏活动Android的工作室后,生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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