Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build errors after adding fullscreen activity in Android Studio

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

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

  • 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?

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. -->

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?

like image 705
Dmitry Osinovskiy Avatar asked Oct 28 '13 10:10

Dmitry Osinovskiy


1 Answers

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.

like image 100
Sergii Pechenizkyi Avatar answered Nov 01 '22 16:11

Sergii Pechenizkyi