Error:(144) Attribute “srcCompat” has already been

2020-06-29 11:35发布

I've coded an application which can post tweets and you can see user timelines and search timelines with it. I did that with the TwitterAPI and fabric.io. And if I want to generate an APK file or sync the Gradle file, I get these errors:

C:\Users\Alexander\AndroidStudioProjects\FacebookPlus\app\build\intermediates\res\merged\debug\values\values.xml

Error:(140) Attribute "srcCompat" has already been defined

Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Alexander\AppData\Local\Android\sdk1\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

4条回答
We Are One
2楼-- · 2020-06-29 12:01

app:srcCompat is an xml attribute usually applied to views like ImageView.

Maybe you declared that attribute twice in the same view.

查看更多
地球回转人心会变
3楼-- · 2020-06-29 12:11

I had the same problem but I found a workable solution. Here's the link. Hopefully it sorts you out...

查看更多
劫难
4楼-- · 2020-06-29 12:16

I had this issue as well.

In my case, the problem was that the support libraries in my gradle file's dependency section should all be the same version.

More info here: Gradle error "Attribute "xxx" has already been defined" in Android Studio

查看更多
太酷不给撩
5楼-- · 2020-06-29 12:18

Answer for Alan_UK's request - I cant post the full content because it is too long. I only post the content which includes the dual attributes

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="http://schemas.android.com/tools">
<attr format="reference" name="backgroundCompat"/>
<attr format="reference|color" name="dgts__accentColor"/>
<attr format="reference" name="dgts__logoDrawable"/>
<attr format="reference" name="drawerArrowStyle"/>
<attr format="dimension" name="height"/>
<attr format="boolean" name="isInScrollContainer"/>
<attr format="boolean" name="isLightTheme"/>
<attr format="reference" name="srcCompat"/>
<attr format="string" name="title"/>
<attr format="reference" name="tw__twitter_logo"/>
<bool name="abc_action_bar_embed_tabs">true</bool>
<bool name="abc_action_bar_embed_tabs_pre_jb">false</bool>
<bool name="abc_action_bar_expanded_action_views_exclusive">true</bool>
<bool name="abc_allow_stacked_button_bar">true</bool>
<bool name="abc_config_actionMenuItemAllCaps">true</bool>
<bool name="abc_config_allowActionMenuItemTextWithIcon">false</bool>
<bool name="abc_config_closeDialogWhenTouchOutside">true</bool>
<bool name="abc_config_showMenuShortcutsWhenKeyboardPresent">false</bool>
<color name="abc_input_method_navigation_guard">@android:color/black</color>
<color name="abc_search_url_text_normal">#7fa87f</color>
<color name="abc_search_url_text_pressed">@android:color/black</color>
<color name="abc_search_url_text_selected">@android:color/black</color>
<color name="accent_material_dark">@color/material_deep_teal_200</color>
<color name="accent_material_light">@color/material_deep_teal_500</color>
<color name="background_floating_material_dark">@color/material_grey_800</color>
<color name="background_floating_material_light">@android:color/white</color>
<color name="background_material_dark">@color/material_grey_850</color>
<color name="background_material_light">@color/material_grey_50</color>
<color name="bright_foreground_disabled_material_dark">#80ffffff</color>
<color name="bright_foreground_disabled_material_light">#80000000</color>
<color name="bright_foreground_inverse_material_dark">@color/bright_foreground_material_light</color>
<color name="bright_foreground_inverse_material_light">@color/bright_foreground_material_dark</color>
<color name="bright_foreground_material_dark">@android:color/white</color>
<color name="bright_foreground_material_light">@android:color/black</color>
<color name="button_material_dark">#ff5a595b</color>
<color name="button_material_light">#ffd6d7d7</color>
<color name="colorAccent">#e99224</color>
<color name="colorAccentDark">#004676</color>
<color name="colorPrimary">#25c7ac</color>
<color name="colorPrimaryDark">#1d9f8a</color>
<color name="colorfb">#32588e</color>
<color name="design_fab_shadow_end_color">@android:color/transparent</color>
<color name="design_fab_shadow_mid_color">#14000000</color>
<color name="design_fab_shadow_start_color">#44000000</color>
<color name="design_fab_stroke_end_inner_color">#0A000000</color>
<color name="design_fab_stroke_end_outer_color">#0F000000</color>
<color name="design_fab_stroke_top_inner_color">#1AFFFFFF</color>
<color name="design_fab_stroke_top_outer_color">#2EFFFFFF</color>
<color name="design_snackbar_background_color">#323232</color>
<color name="design_textinput_error_color_dark">#FFFF6E6E</color>
<color name="design_textinput_error_color_light">#FFD50000</color>
<color name="dgts__default_accent">#5baaf4</color>
<color name="dgts__default_logo_name">#56626d</color>
<color name="dgts__purple">#744eaa</color>
<color name="dgts__purple_pressed">#553788</color>
<color name="dgts__text_dark">#ff030303</color>
<color name="dgts__text_light">#ffffff</color>
<color name="dim_foreground_disabled_material_dark">#80bebebe</color>
<color name="dim_foreground_disabled_material_light">#80323232</color>
<color name="dim_foreground_material_dark">#ffbebebe</color>
<color name="dim_foreground_material_light">#ff323232</color>
<color name="disabled">#d1d1d1</color>
<color name="error">#ff2424</color>
<color name="foreground_material_dark">@android:color/white</color>
<color name="foreground_material_light">@android:color/black</color>
<color name="grey">#9e9e9e</color>
<color name="highlighted_text_material_dark">#6680cbc4</color>
<color name="highlighted_text_material_light">#66009688</color>
<color name="hint_foreground_material_dark">@color/bright_foreground_disabled_material_dark</color>
<color name="hint_foreground_material_light">@color/bright_foreground_disabled_material_light</color>
<color name="material_blue_grey_800">#ff37474f</color>
<color name="material_blue_grey_900">#ff263238</color>
<color name="material_blue_grey_950">#ff21272b</color>
<color name="material_deep_teal_200">#ff80cbc4</color>
<color name="material_deep_teal_500">#ff009688</color>
<color name="material_grey_100">#fff5f5f5</color>
<color name="material_grey_300">#ffe0e0e0</color>
<color name="material_grey_50">#fffafafa</color>
<color name="material_grey_600">#ff757575</color>
<color name="material_grey_800">#ff424242</color>
<color name="material_grey_850">#ff303030</color>
<color name="material_grey_900">#ff212121</color>
<color name="primary_dark_material_dark">@android:color/black</color>
<color name="primary_dark_material_light">@color/material_grey_600</color>
<color name="primary_material_dark">@color/material_grey_900</color>
<color name="primary_material_light">@color/material_grey_100</color>
<color name="primary_text_default_material_dark">#ffffffff</color>
<color name="primary_text_default_material_light">#de000000</color>
<color name="primary_text_disabled_material_dark">#4Dffffff</color>
<color name="primary_text_disabled_material_light">#39000000</color>
<color name="ripple_material_dark">#33ffffff</color>
<color name="ripple_material_light">#1f000000</color>
<color name="secondary_text_default_material_dark">#b3ffffff</color>
<color name="secondary_text_default_material_light">#8a000000</color>
<color name="secondary_text_disabled_material_dark">#36ffffff</color>
<color name="secondary_text_disabled_material_light">#24000000</color>
<color name="subtitle">#96ffffff</color>
<color name="sv_bgcolor">#d2000000</color>
<color name="switch_thumb_disabled_material_dark">#ff616161</color>
<color name="switch_thumb_disabled_material_light">#ffbdbdbd</color>
<color name="switch_thumb_normal_material_dark">#ffbdbdbd</color>
<color name="switch_thumb_normal_material_light">#fff1f1f1</color>
<color name="trans">#7cffffff</color>
<color name="tt_accent">#0099ff</color>
<color name="tt_accentdark">#0084dc</color>
<color name="tw__blue_default">#FF5BAAF4</color>
<color name="tw__blue_pressed">#FF4186C8</color>
<color name="tw__blue_pressed_light">#ffe1e8ed</color>
<color name="tw__composer_black">#ff292f33</color>
<color name="tw__composer_blue">#ff1da1f2</color>
<color name="tw__composer_blue_text">#ff1b95e0</color>
<color name="tw__composer_deep_gray">#ff8899A6</color>
<color name="tw__composer_light_gray">#ffccd6dd</color>
<color name="tw__composer_red">#ffe81c4f</color>
<color name="tw__composer_white">#ffffffff</color>
<color name="tw__light_gray">#ccd6dd</color>
<color name="tw__medium_gray">#8899a6</color>
<color name="tw__seekbar_thumb_inner_color">#ffffffff</color>
<color name="tw__seekbar_thumb_outer_color">#4dffffff</color>
<color name="tw__solid_white">#FFFFFFFF</color>
<color name="tw__transparent">#00000000</color>
<color name="tw__tweet_action_color">#55acee</color>
<color name="tw__tweet_action_dark_highlight_color">#667580</color>
<color name="tw__tweet_action_light_highlight_color">#ebeef0</color>
<color name="tw__tweet_dark_container_bg_color">#d9000000</color>
<color name="tw__tweet_dark_primary_text_color">#e1ffffff</color>
<color name="tw__tweet_light_container_bg_color">#ffffff</color>
<color name="tw__tweet_light_primary_text_color">#292f33</color>
<declare-styleable name="ActionBar"><attr name="navigationMode"><enum name="normal" value="0"/><enum name="listMode" value="1"/><enum name="tabMode" value="2"/></attr><attr name="displayOptions"><flag name="none" value="0"/><flag name="useLogo" value="0x1"/><flag name="showHome" value="0x2"/><flag name="homeAsUp" value="0x4"/><flag name="showTitle" value="0x8"/><flag name="showCustom" value="0x10"/><flag name="disableHome" value="0x20"/></attr><attr name="title"/><attr format="string" name="subtitle"/><attr format="reference" name="titleTextStyle"/><attr format="reference" name="subtitleTextStyle"/><attr format="reference" name="icon"/><attr format="reference" name="logo"/><attr format="reference" name="divider"/><attr format="reference" name="background"/><attr format="reference|color" name="backgroundStacked"/><attr format="reference|color" name="backgroundSplit"/><attr format="reference" name="customNavigationLayout"/><attr name="height"/><attr format="reference" name="homeLayout"/><attr format="reference" name="progressBarStyle"/><attr format="reference" name="indeterminateProgressStyle"/><attr format="dimension" name="progressBarPadding"/><attr name="homeAsUpIndicator"/><attr format="dimension" name="itemPadding"/><attr format="boolean" name="hideOnContentScroll"/><attr format="dimension" name="contentInsetStart"/><attr format="dimension" name="contentInsetEnd"/><attr format="dimension" name="contentInsetLeft"/><attr format="dimension" name="contentInsetRight"/><attr format="dimension" name="elevation"/><attr format="reference" name="popupTheme"/></declare-styleable>
<declare-styleable name="ActionBarLayout"><attr name="android:layout_gravity"/></declare-styleable>
<declare-styleable name="ActionMenuItemView"><attr name="android:minWidth"/></declare-styleable>
<declare-styleable name="ActionMenuView"/>
<declare-styleable name="ActionMode"><attr name="titleTextStyle"/><attr name="subtitleTextStyle"/><attr name="background"/><attr name="backgroundSplit"/><attr name="height"/><attr format="reference" name="closeItemLayout"/></declare-styleable>
<declare-styleable name="ActivityChooserView"><attr format="string" name="initialActivityCount"/><attr format="reference" name="expandActivityOverflowButtonDrawable"/></declare-styleable>
<declare-styleable name="AlertDialog"><attr name="android:layout"/><attr format="reference" name="buttonPanelSideLayout"/><attr format="reference" name="listLayout"/><attr format="reference" name="multiChoiceItemLayout"/><attr format="reference" name="singleChoiceItemLayout"/><attr format="reference" name="listItemLayout"/></declare-styleable>
<declare-styleable name="AppBarLayout"><attr name="elevation"/><attr name="android:background"/><attr format="boolean" name="expanded"/></declare-styleable>
<declare-styleable name="AppBarLayout_LayoutParams"><attr name="layout_scrollFlags"><flag name="scroll" value="0x1"/><flag name="exitUntilCollapsed" value="0x2"/><flag name="enterAlways" value="0x4"/><flag name="enterAlwaysCollapsed" value="0x8"/><flag name="snap" value="0x10"/></attr><attr format="reference" name="layout_scrollInterpolator"/></declare-styleable>
<declare-styleable name="AppCompatImageView"><attr name="android:src"/><attr format="reference" name="srcCompat"/></declare-styleable>
查看更多
登录 后发表回答