Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: unknown tag <:string> in my app

When I try to run a specific app, Gradle doesn't compile and shows this strange error. I searched for the tag in the file but such a tag doesn't exist. The exact state of the app

error: unknown tag <:string>. Message{kind=ERROR, text=error: unknown tag <:string>., sources=[C:\Users\nEW u.gradle\caches\transforms-1\files-1.1\constraint-layout-1.1.0.aar\b3e4ef6bef14a8fe09fa894d105f65d7\res\values\values.xml:3:5-61], original message=, tool name=Optional.of(AAPT)}

However, this isn't the case for other apps I built before, they run smoothly without any error. Please tell me what is the remedy. Thank you before-hand.

EDIT: Newer projects too face the same problem.

Edit 2: When I remove the implementation 'com.android.support.constraint:constraint-layout:1.1.0' at build.gradle of the app. It shows this error.

error: unknown tag <:string>. Message{kind=ERROR, text=error: unknown tag <:string>., sources=[C:\Users\nEW u.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.1.aar\375c9cd48ecaf5e9681416f258535c78\res\values\values.xml:3:5-61], original message=, tool name=Optional.of(AAPT)}

The files C:\Users\nEW u.gradle\caches\transforms-1\files-1.1\constraint-layout-1.1.0.aar\b3e4ef6bef14a8fe09fa894d105f65d7\res\values\values.xml:3:5-61

<?xml version="1.0" encoding="utf-8"?>
    <resources>
        <attr format="boolean" name="barrierAllowsGoneWidgets"/>
        <attr format="enum" name="barrierDirection">
            <enum name="left" value="0"/>
            <enum name="right" value="1"/>
            <enum name="top" value="2"/>
            <enum name="bottom" value="3"/>
            <enum name="start" value="5"/>
            <enum name="end" value="6"/>
        </attr>
        <attr format="boolean" name="chainUseRtl"/>
        <attr format="reference" name="constraintSet"/>
        <attr format="string" name="constraint_referenced_ids"/>
        <attr format="reference" name="content"/>
        <attr name="emptyVisibility">
            <enum name="gone" value="0"/>
            <enum name="invisible" value="1"/>
        </attr>
        <attr format="boolean" name="layout_constrainedHeight"/>
        <attr format="boolean" name="layout_constrainedWidth"/>
        <attr format="integer" name="layout_constraintBaseline_creator"/>
        <attr format="reference|enum" name="layout_constraintBaseline_toBaselineOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="integer" name="layout_constraintBottom_creator"/>
        <attr format="reference|enum" name="layout_constraintBottom_toBottomOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference|enum" name="layout_constraintBottom_toTopOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference" name="layout_constraintCircle"/>
        <attr format="integer" name="layout_constraintCircleAngle"/>
        <attr format="dimension" name="layout_constraintCircleRadius"/>
        <attr format="string" name="layout_constraintDimensionRatio"/>
        <attr format="reference|enum" name="layout_constraintEnd_toEndOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference|enum" name="layout_constraintEnd_toStartOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="dimension" name="layout_constraintGuide_begin"/>
        <attr format="dimension" name="layout_constraintGuide_end"/>
        <attr format="float" name="layout_constraintGuide_percent"/>
        <attr name="layout_constraintHeight_default">
            <enum name="spread" value="0"/>
            <enum name="wrap" value="1"/>
            <enum name="percent" value="2"/>
        </attr>
        <attr format="dimension|enum" name="layout_constraintHeight_max">
            <enum name="wrap" value="-2"/>
        </attr>
        <attr format="dimension|enum" name="layout_constraintHeight_min">
            <enum name="wrap" value="-2"/>
        </attr>
        <attr format="float" name="layout_constraintHeight_percent"/>
        <attr format="float" name="layout_constraintHorizontal_bias"/>
        <attr format="enum" name="layout_constraintHorizontal_chainStyle">
            <enum name="spread" value="0"/>
            <enum name="spread_inside" value="1"/>
            <enum name="packed" value="2"/>
        </attr>
        <attr format="float" name="layout_constraintHorizontal_weight"/>
        <attr format="integer" name="layout_constraintLeft_creator"/>
        <attr format="reference|enum" name="layout_constraintLeft_toLeftOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference|enum" name="layout_constraintLeft_toRightOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="integer" name="layout_constraintRight_creator"/>
        <attr format="reference|enum" name="layout_constraintRight_toLeftOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference|enum" name="layout_constraintRight_toRightOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference|enum" name="layout_constraintStart_toEndOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference|enum" name="layout_constraintStart_toStartOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="integer" name="layout_constraintTop_creator"/>
        <attr format="reference|enum" name="layout_constraintTop_toBottomOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="reference|enum" name="layout_constraintTop_toTopOf">
            <enum name="parent" value="0"/>
        </attr>
        <attr format="float" name="layout_constraintVertical_bias"/>
        <attr format="enum" name="layout_constraintVertical_chainStyle">
            <enum name="spread" value="0"/>
            <enum name="spread_inside" value="1"/>
            <enum name="packed" value="2"/>
        </attr>
        <attr format="float" name="layout_constraintVertical_weight"/>
        <attr name="layout_constraintWidth_default">
            <enum name="spread" value="0"/>
            <enum name="wrap" value="1"/>
            <enum name="percent" value="2"/>
        </attr>
        <attr format="dimension|enum" name="layout_constraintWidth_max">
            <enum name="wrap" value="-2"/>
        </attr>
        <attr format="dimension|enum" name="layout_constraintWidth_min">
            <enum name="wrap" value="-2"/>
        </attr>
        <attr format="float" name="layout_constraintWidth_percent"/>
        <attr format="dimension" name="layout_editor_absoluteX"/>
        <attr format="dimension" name="layout_editor_absoluteY"/>
        <attr format="dimension" name="layout_goneMarginBottom"/>
        <attr format="dimension" name="layout_goneMarginEnd"/>
        <attr format="dimension" name="layout_goneMarginLeft"/>
        <attr format="dimension" name="layout_goneMarginRight"/>
        <attr format="dimension" name="layout_goneMarginStart"/>
        <attr format="dimension" name="layout_goneMarginTop"/>
        <attr name="layout_optimizationLevel">
            <flag name="none" value="0"/>
            <flag name="standard" value="3"/> <!-- for now only direct & barriers -->
            <flag name="direct" value="1"/>
            <flag name="barrier" value="2"/>
            <flag name="chains" value="4"/>
            <flag name="dimensions" value="8"/>
        </attr>
        <declare-styleable name="ConstraintLayout_Layout"><attr name="android:orientation"/><attr name="android:minWidth"/><attr name="android:minHeight"/><attr name="android:maxWidth"/><attr name="android:maxHeight"/><attr name="layout_optimizationLevel"/><attr name="constraintSet"/><attr name="barrierDirection"/><attr name="barrierAllowsGoneWidgets"/><attr name="constraint_referenced_ids"/><attr name="chainUseRtl"/><attr name="layout_constraintCircle"/><attr name="layout_constraintCircleRadius"/><attr name="layout_constraintCircleAngle"/><attr name="layout_constraintGuide_begin"/><attr name="layout_constraintGuide_end"/><attr name="layout_constraintGuide_percent"/><attr name="layout_constraintLeft_toLeftOf"/><attr name="layout_constraintLeft_toRightOf"/><attr name="layout_constraintRight_toLeftOf"/><attr name="layout_constraintRight_toRightOf"/><attr name="layout_constraintTop_toTopOf"/><attr name="layout_constraintTop_toBottomOf"/><attr name="layout_constraintBottom_toTopOf"/><attr name="layout_constraintBottom_toBottomOf"/><attr name="layout_constraintBaseline_toBaselineOf"/><attr name="layout_constraintStart_toEndOf"/><attr name="layout_constraintStart_toStartOf"/><attr name="layout_constraintEnd_toStartOf"/><attr name="layout_constraintEnd_toEndOf"/><attr name="layout_goneMarginLeft"/><attr name="layout_goneMarginTop"/><attr name="layout_goneMarginRight"/><attr name="layout_goneMarginBottom"/><attr name="layout_goneMarginStart"/><attr name="layout_goneMarginEnd"/><attr name="layout_constrainedWidth"/><attr name="layout_constrainedHeight"/><attr name="layout_constraintHorizontal_bias"/><attr name="layout_constraintVertical_bias"/><attr name="layout_constraintWidth_default"/><attr name="layout_constraintHeight_default"/><attr name="layout_constraintWidth_min"/><attr name="layout_constraintWidth_max"/><attr name="layout_constraintWidth_percent"/><attr name="layout_constraintHeight_min"/><attr name="layout_constraintHeight_max"/><attr name="layout_constraintHeight_percent"/><attr name="layout_constraintLeft_creator"/><attr name="layout_constraintTop_creator"/><attr name="layout_constraintRight_creator"/><attr name="layout_constraintBottom_creator"/><attr name="layout_constraintBaseline_creator"/><attr name="layout_constraintDimensionRatio"/><attr name="layout_constraintHorizontal_weight"/><attr name="layout_constraintVertical_weight"/><attr name="layout_constraintHorizontal_chainStyle"/><attr name="layout_constraintVertical_chainStyle"/><attr name="layout_editor_absoluteX"/><attr name="layout_editor_absoluteY"/></declare-styleable>
        <declare-styleable name="ConstraintLayout_placeholder"><attr name="emptyVisibility"/><attr name="content"/></declare-styleable>
        <declare-styleable name="ConstraintSet"><attr name="android:orientation"/><attr name="android:id"/><attr name="android:visibility"/><attr name="android:alpha"/><attr name="android:elevation"/><attr name="android:rotation"/><attr name="android:rotationX"/><attr name="android:rotationY"/><attr name="android:scaleX"/><attr name="android:scaleY"/><attr name="android:transformPivotX"/><attr name="android:transformPivotY"/><attr name="android:translationX"/><attr name="android:translationY"/><attr name="android:translationZ"/><attr name="android:layout_width"/><attr name="android:layout_height"/><attr name="android:layout_marginStart"/><attr name="android:layout_marginBottom"/><attr name="android:layout_marginTop"/><attr name="android:layout_marginEnd"/><attr name="android:layout_marginLeft"/><attr name="android:layout_marginRight"/><attr name="layout_constraintCircle"/><attr name="layout_constraintCircleRadius"/><attr name="layout_constraintCircleAngle"/><attr name="layout_constraintGuide_begin"/><attr name="layout_constraintGuide_end"/><attr name="layout_constraintGuide_percent"/><attr name="layout_constraintLeft_toLeftOf"/><attr name="layout_constraintLeft_toRightOf"/><attr name="layout_constraintRight_toLeftOf"/><attr name="layout_constraintRight_toRightOf"/><attr name="layout_constraintTop_toTopOf"/><attr name="layout_constraintTop_toBottomOf"/><attr name="layout_constraintBottom_toTopOf"/><attr name="layout_constraintBottom_toBottomOf"/><attr name="layout_constraintBaseline_toBaselineOf"/><attr name="layout_constraintStart_toEndOf"/><attr name="layout_constraintStart_toStartOf"/><attr name="layout_constraintEnd_toStartOf"/><attr name="layout_constraintEnd_toEndOf"/><attr name="layout_goneMarginLeft"/><attr name="layout_goneMarginTop"/><attr name="layout_goneMarginRight"/><attr name="layout_goneMarginBottom"/><attr name="layout_goneMarginStart"/><attr name="layout_goneMarginEnd"/><attr name="layout_constrainedWidth"/><attr name="layout_constrainedHeight"/><attr name="layout_constraintHorizontal_bias"/><attr name="layout_constraintVertical_bias"/><attr name="layout_constraintWidth_default"/><attr name="layout_constraintHeight_default"/><attr name="layout_constraintWidth_min"/><attr name="layout_constraintWidth_max"/><attr name="layout_constraintWidth_percent"/><attr name="layout_constraintHeight_min"/><attr name="layout_constraintHeight_max"/><attr name="layout_constraintHeight_percent"/><attr name="layout_constraintLeft_creator"/><attr name="layout_constraintTop_creator"/><attr name="layout_constraintRight_creator"/><attr name="layout_constraintBottom_creator"/><attr name="layout_constraintBaseline_creator"/><attr name="layout_constraintDimensionRatio"/><attr name="layout_constraintHorizontal_weight"/><attr name="layout_constraintVertical_weight"/><attr name="layout_constraintHorizontal_chainStyle"/><attr name="layout_constraintVertical_chainStyle"/><attr name="layout_editor_absoluteX"/><attr name="layout_editor_absoluteY"/></declare-styleable>
        <declare-styleable name="LinearConstraintLayout"><attr name="android:orientation"/></declare-styleable>
    </resources>

C:\Users\nEW u.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.1.aar\375c9cd48ecaf5e9681416f258535c78\res\values\values.xml:3:5-61

<?xml version="1.0" encoding="utf-8"?>

        <flag name="bottom" value="0x50"/>

        <flag name="left" value="0x03"/>

        <flag name="right" value="0x05"/>

        <flag name="center_vertical" value="0x10"/>

        <flag name="fill_vertical" value="0x70"/>

        <flag name="center_horizontal" value="0x01"/>

        <flag name="fill_horizontal" value="0x07"/>

        <flag name="center" value="0x11"/>

        <flag name="fill" value="0x77"/>

        <flag name="clip_vertical" value="0x80"/>

        <flag name="clip_horizontal" value="0x08"/>

        <flag name="start" value="0x00800003"/>

        <flag name="end" value="0x00800005"/>
    </attr><attr format="enum" name="layout_insetEdge">

        <enum name="none" value="0x0"/>

        <enum name="top" value="0x30"/>

        <enum name="bottom" value="0x50"/>

        <enum name="left" value="0x03"/>

        <enum name="right" value="0x05"/>

        <enum name="start" value="0x00800003"/>

        <enum name="end" value="0x00800005"/>
    </attr><attr name="layout_dodgeInsetEdges">

        <flag name="none" value="0x0"/>

        <flag name="top" value="0x30"/>

        <flag name="bottom" value="0x50"/>

        <flag name="left" value="0x03"/>

        <flag name="right" value="0x05"/>

        <flag name="start" value="0x00800003"/>

        <flag name="end" value="0x00800005"/>

        <flag name="all" value="0x77"/>
    </attr></declare-styleable>
<style name="Widget.Support.CoordinatorLayout" parent="android:Widget">
    <item name="statusBarBackground">#000000</item>
</style>

like image 452
Srinjoy Santra Avatar asked Jun 09 '18 08:06

Srinjoy Santra


1 Answers

Had very similar error. As turned out the reason was related to string array. In your string.xml check if you have empty <string-array> or something like

<string-array name="array_name">
    <string name="array_name_item">Some text</string>
    ...
</string-array>

You should update <string> tag to <item> tag like this:

<string-array name="array_name">
    <item name="array_name_item">Some text</item>
    ...
</string-array>

Hope it solves your issue, because Android Studio error message is really confusing here.

like image 163
Khrystyna Pochynok Avatar answered Nov 12 '22 16:11

Khrystyna Pochynok