Android支持库内部版本v26.X.X内部版本错误:属性“ fontFamily”已使用不兼容的格式定义

时间:2018-12-14 11:14:02

标签: android xml gradle styles android-support-library

我将支持构建库从25.4.0更新为26.x.x,我得到

AGPBI: {"kind":"error","text":"Original attribute defined here.","sources":[{"file":"/Users/me/AndroidStudioProjects/Mail/mail/build/intermediates/res/merged/dev/debug/values/values.xml","position":{"startLine":40}}],"original":"","tool":"AAPT"}
/Users/me/AndroidStudioProjects/Mail/mail/build/intermediates/res/merged/dev/debug/values/values.xml:373: error: Attribute "fontFamily" already defined with incompatible format.
/Users/me/AndroidStudioProjects/Mail/mail/build/intermediates/res/merged/dev/debug/values/values.xml:41: Original attribute defined here.

我确实清理了项目->重建,使Studio无效并重新启动,从android:fontFamily(现在只是fontFamily)中删除了android前缀,从其他库中排除了模块(存在冲突)。

我的styles.xml:

<style name="CurrentTheme" parent="@style/AppTheme.Base">
        <!-- Common styles -->
        <item name="android:windowBackground">@color/bg</item>
        <item name="android:colorBackground">@color/bg</item>
        <item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextView</item>

        <item name="android:actionOverflowButtonStyle">@style/OverFlow.Light</item>
        <item name="actionOverflowButtonStyle">@style/OverFlow.Light</item>
        <item name="actionModeStyle">@style/MessagesListActionMode</item>
        <item name="actionModeCloseDrawable">@drawable/ic_action_cancel</item>

        <item name="android:itemTextAppearance">@style/myCustomMenuTextApearance</item>
        <item name="searchViewStyle">@style/MySearchViewStyle</item>

        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>

        <item name="colorAccent">@color/logo_color</item>

        <item name="colorControlNormal">@color/col888</item>
        <item name="colorControlActivated">@color/logo_color</item>

        <item name="homeAsUpIndicator">@drawable/ab_back_button_bg_states</item>

        <item name="alertDialogTheme">@style/CurrentTheme.AlertDialog</item>

        <item name="actionMenuTextColor">@color/logo_color</item>
        <item name="toolbarStyle">@style/CurrentTheme.Toolbar</item>
    </style>

    <style name="CurrentTheme.WithoutPreview" parent="CurrentTheme.Transparent" >
        <item name="android:windowDisablePreview">true</item>
    </style>

    <style name="CurrentTheme.Transparent" parent="CurrentTheme" />

    <style name="TodoWelcomeTheme" parent="@style/CurrentTheme" />

    <style name="CurrentTheme.Toolbar" parent="@style/Widget.AppCompat.Toolbar">
        <item name="contentInsetStart">72dp</item>
    </style>

    <style name="CurrentTheme.AlertDialog" parent="@style/Theme.AppCompat.Light.Dialog.Alert">
        <item name="colorAccent">@color/color14</item>
    </style>

    <style name="CurrentTheme.AlertDialog.ButtonBarStyle" />

    <style name="OverFlow.Light" parent="@android:style/Widget.Holo.ActionButton.Overflow">
        <item name="android:contentDescription">@string/overflow_expose_cd</item>
        <item name="android:src">@drawable/ic_overflow_blue</item>
    </style>

    <style name="myCustomMenuTextApearance" parent="@android:style/TextAppearance.Widget.IconMenu.Item">
        <item name="android:textColor">@drawable/text_selector</item>
    </style>


    <style name="AppTheme.Base" parent="@style/Theme.AppCompat.Light.DarkActionBar" />

    <style name="MySearchViewStyle" parent="Widget.AppCompat.SearchView">
        <item name="searchIcon">@android:color/transparent</item>
        <item name="closeIcon">@drawable/ic_close_white_24dp</item>
    </style>

    <style name="MessagesListActionMode" parent="Widget.AppCompat.ActionMode">
        <item name="background">@color/toolbar_am_bg</item>
        <item name="android:background">@color/toolbar_am_bg</item>
        <item name="android:height">56dp</item>
        <item name="android:titleTextStyle">@style/ActionModeTitle</item>
    </style>

    <style name="ActionModeTitle" parent="TextAppearance.AppCompat.Widget.ActionMode.Title">
        <item name="android:textColor">@color/actionbar_text_color</item>
        <item name="android:textSize">@dimen/font_20pt</item>
        <item name="android:textStyle">normal</item>
        <item name="fontFamily">@string/font_roboto_medium</item>
    </style>

    <style name="TestStyle" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorAccent">@color/color2</item>
    </style>

    <style name="CurrentTheme.Widget" />

    <style name="CurrentTheme.Widget.SocialButton">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginRight">5dp</item>
        <item name="android:layout_marginLeft">5dp</item>
    </style>

    <style name="OtherMail.floating_text_view" parent="android:style/Widget.TextView">
        <item name="android:textSize">@dimen/font_12pt</item>
        <item name="android:textColor">@color/color4</item>
    </style>

    <style name="OtherMail.edit_text" parent="android:style/Widget.EditText">
        <item name="android:textSize">@dimen/font_16pt</item>
        <item name="android:singleLine">true</item>
        <item name="android:background">@drawable/textedit_bg_state</item>
        <item name="android:textColor">@color/color7</item>
        <item name="android:textColorHint">@color/color7</item>
    </style>
</style>

等等

如果正确答案我应该给您更多信息,请告诉我。

1 个答案:

答案 0 :(得分:1)

我发现该库的支持库版本不正确。我在其中排除了支持库组(示例this)(或者我可以删除该库或对其进行更新),但是它对我不起作用,因此我对库进行了更新(但我认为排除也应该起作用)我的项目建成了。

问题:
抛出错误的库如下所示: enter image description here
我的日志没有向我显示问题出在哪里(间接地,在生成的文件中提到了roboto)。

决定:
1)您可以排除引发错误的组: enter image description here
2)或更新:
enter image description here

我希望我的回答能对某人有所帮助。