Ошибка в Android Studio xml

Сегодня я просто обновляю свою студию Android ... В этом случае я столкнулся с большей ошибкой в ​​файле xml

AGPBI: {"kind":"error","text":"error: attribute
\u0027android:contentScrim\u0027 not found.","sources": [{"file":"C:\Users\priya\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main6.xml","position":{"startLine":12}}],"original":"","tool":"AAPT"} AGPBI: {"kind":"error","text":"error: \u0027attr/actionBarSize\u0027 is incompatible with attribute android:layout_height (attr) dimension|enum [fill_parent\u003d4294967295, match_parent\u003d4294967295, wrap_content\u003d4294967294].","sources":[{"file":"C:\Users\priya\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main6.xml","position":{"startLine":22}}],"original":"","tool":"AAPT"} AGPBI: {"kind":"error","text":"error: attribute \u0027android:srcCompact\u0027 not found.","sources":[{"file":"C:\Users\priya\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main6.xml","position":{"startLine":61}}],"original":"","tool":"AAPT"} AGPBI: {"kind":"error","text":"error: attribute \u0027android:srcCompact\u0027 not found.","sources":[{"file":"C:\Users\priya\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main6.xml","position":{"startLine":99}}],"original":"","tool":"AAPT"} AGPBI: {"kind":"error","text":"error: attribute \u0027android:srcCompact\u0027 not found.","sources":[{"file":"C:\Users\priya\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main6.xml","position":{"startLine":144}}],"original":"","tool":"AAPT"} AGPBI: {"kind":"error","text":"error: attribute \u0027android:srcCompact\u0027 not found.","sources":[{"file":"C:\Users\priya\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main6.xml","position":{"startLine":182}}],"original":"","tool":"AAPT"} AGPBI: {"kind":"error","text":"error: attribute \u0027android:srcCompact\u0027 not found.","sources":[{"file":"C:\Users\priya\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main6.xml","position":{"startLine":227}}],"original":"","tool":"AAPT"}

FAILURE: Build failed with an exception.

  • Что пошло не так: Не удалось выполнить задачу ': app: processDebugResources'.

    Failed to process resources, see aapt output above for details.

  • Пытаться: Запустите с параметром --stacktrace, чтобы получить трассировку стека. Запустите с параметром --info или --debug, чтобы получить больше результатов журнала. Запустите с --scan, чтобы получить полную информацию.

  • Получите дополнительную помощь на https://help.gradle.org

СБРОСИТЬ СБОЙ через 29 с.

Я пытаюсь исправить это, но не могу ... об этом никто не знает ... Спасибо


Это моя деятельность

<?xml version = "1.0" encoding = "utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
xmlns:tools = "http://schemas.android.com/tools"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
tools:context = "com.kara.kavin.myapplication.Main6Activity">
<android.support.design.widget.AppBarLayout
    android:id = "@+id/appbar"
    android:layout_width = "match_parent"
    android:layout_height = "300dp"
    android:theme = "@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
    android:id = "@+id/collasingtoolbar"
    android:layout_width = "match_parent"
    android:layout_height = "match_parent"
    app:layout_scrollFlags = "exitUntilCollapsed|scroll"
    android:contentScrim = "?attr/colorPrimary"
    app:title = "NEAT Patrol"
    app:expandedTitleMarginStart = "48dp"
    app:expandedTitleMarginEnd = "64dp"
    android:background = "@drawable/sam">
    <android.support.v7.widget.Toolbar
        android:id = "@+id/toolbarid"
        app:popupTheme = "@style/ThemeOverlay.AppCompat.Light"
        app:layout_collapseMode = "pin"
        android:layout_width = "match_parent"
        android:layout_height = "attr/actionBarSize"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:layout_width = "match_parent"
    android:layout_height = "match_parent"
    app:layout_behavior = "@string/appbar_scrolling_view_behavior">
    <LinearLayout
        android:layout_width = "match_parent"
        android:layout_height = "match_parent"
        android:orientation = "vertical"
        android:padding = "10dp"
        android:background = "#fcfcfc"
        android:gravity = "center"
        android:id = "@+id/ll">
        <LinearLayout
            android:clipToPadding = "false"
            android:gravity = "center"
            android:orientation = "horizontal"
            android:layout_width = "match_parent"
            android:layout_height = "wrap_content">
            <android.support.v7.widget.CardView
                android:foreground = "?android:attr/selectableItemBackground"
                android:clickable = "true"
                android:id = "@+id/bankcardId"
                android:layout_width = "160dp"
                android:layout_height = "190dp"
                android:layout_margin = "10dp">
                <LinearLayout
                    android:layout_width = "match_parent"
                    android:layout_height = "match_parent"
                    android:orientation = "vertical"
                    android:gravity = "center">
                    <ImageView
                        android:layout_width = "64dp"
                        android:layout_height = "64dp"
                        android:background = "@drawable/cerclebackgroundpurple"
                        android:srcCompact = "@drawable/ic_attach_money_black_24dp"
                        android:padding = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:textStyle = "bold"
                        android:layout_marginTop = "10dp"
                        android:text = "Banking"/>
                    <View
                        android:layout_width = "match_parent"
                        android:layout_height = "1dp"
                        android:background = "@color/lightgray"
                        android:layout_margin = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:gravity = "center"
                        android:text = "Check your bank activities"
                        android:padding = "5dp"
                        android:textColor = "@android:color/darker_gray"/>
                </LinearLayout>
            </android.support.v7.widget.CardView>

            <android.support.v7.widget.CardView
                android:foreground = "?android:attr/selectableItemBackground"
                android:clickable = "true"
                android:layout_width = "160dp"
                android:layout_height = "190dp"
                android:layout_margin = "10dp">
                <LinearLayout
                    android:layout_width = "match_parent"
                    android:layout_height = "match_parent"
                    android:orientation = "vertical"
                    android:gravity = "center">
                    <ImageView
                        android:layout_width = "64dp"
                        android:layout_height = "64dp"
                        android:background = "@drawable/cerclebackgroundpink"
                        android:srcCompact = "@drawable/ic_lightbulb_outline_black_24dp"
                        android:padding = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:textStyle = "bold"
                        android:layout_marginTop = "10dp"
                        android:text = "Ideas"/>
                    <View
                        android:layout_width = "match_parent"
                        android:layout_height = "1dp"
                        android:background = "@color/lightgray"
                        android:layout_margin = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:gravity = "center"
                        android:text = "Check your bank activities"
                        android:padding = "5dp"
                        android:textColor = "@android:color/darker_gray"/>
                </LinearLayout>
            </android.support.v7.widget.CardView>
        </LinearLayout>

        <LinearLayout
            android:clipToPadding = "false"
            android:gravity = "center"
            android:orientation = "horizontal"
            android:layout_width = "match_parent"
            android:layout_height = "wrap_content">
            <android.support.v7.widget.CardView
                android:foreground = "?android:attr/selectableItemBackground"
                android:clickable = "true"
                android:layout_width = "160dp"
                android:layout_height = "190dp"
                android:layout_margin = "10dp">
                <LinearLayout
                    android:layout_width = "match_parent"
                    android:layout_height = "match_parent"
                    android:orientation = "vertical"
                    android:gravity = "center">
                    <ImageView
                        android:layout_width = "64dp"
                        android:layout_height = "64dp"
                        android:background = "@drawable/cerclebackgroundgreen"
                        android:srcCompact = "@drawable/ic_control_point_black_24dp"
                        android:padding = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:textStyle = "bold"
                        android:layout_marginTop = "10dp"
                        android:text = "Add"/>
                    <View
                        android:layout_width = "match_parent"
                        android:layout_height = "1dp"
                        android:background = "@color/lightgray"
                        android:layout_margin = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:gravity = "center"
                        android:text = "Check your bank activities"
                        android:padding = "5dp"
                        android:textColor = "@android:color/darker_gray"/>
                </LinearLayout>
            </android.support.v7.widget.CardView>

            <android.support.v7.widget.CardView
                android:foreground = "?android:attr/selectableItemBackground"
                android:clickable = "true"
                android:layout_width = "160dp"
                android:layout_height = "190dp"
                android:layout_margin = "10dp">
                <LinearLayout
                    android:layout_width = "match_parent"
                    android:layout_height = "match_parent"
                    android:gravity = "center"
                    android:orientation = "vertical">
                    <ImageView
                        android:layout_width = "64dp"
                        android:layout_height = "64dp"
                        android:background = "@drawable/cerclebackgroundyello"
                        android:padding = "10dp"
                        android:srcCompact = "@drawable/ic_attach_file_black_24dp" />
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:layout_marginTop = "10dp"
                        android:text = "Links"
                        android:textStyle = "bold" />
                    <View
                        android:layout_width = "match_parent"
                        android:layout_height = "1dp"
                        android:layout_margin = "10dp"
                        android:background = "@color/lightgray" />
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:gravity = "center"
                        android:padding = "5dp"
                        android:text = "Check your bank activities"
                        android:textColor = "@android:color/darker_gray" />
                </LinearLayout>
            </android.support.v7.widget.CardView>
        </LinearLayout>

        <LinearLayout
            android:clipToPadding = "false"
            android:gravity = "center"
            android:orientation = "horizontal"
            android:layout_width = "match_parent"
            android:layout_height = "wrap_content">
            <android.support.v7.widget.CardView
                android:foreground = "?android:attr/selectableItemBackground"
                android:clickable = "true"
                android:layout_width = "340dp"
                android:layout_height = "150dp"
                android:layout_margin = "10dp">
                <LinearLayout
                    android:layout_width = "match_parent"
                    android:layout_height = "match_parent"
                    android:orientation = "vertical"
                    android:gravity = "center">
                    <ImageView
                        android:layout_width = "64dp"
                        android:layout_height = "64dp"
                        android:background = "@drawable/cerclebackgroundpurple"
                        android:srcCompact = "@drawable/ic_wifi_black_24dp"
                        android:padding = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:textStyle = "bold"
                        android:layout_marginTop = "10dp"
                        android:text = "Add"/>
                    <View
                        android:layout_width = "match_parent"
                        android:layout_height = "1dp"
                        android:background = "@color/lightgray"
                        android:layout_margin = "10dp"/>
                    <TextView
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:gravity = "center"
                        android:text = "Check your bank activities"
                        android:padding = "5dp"
                        android:textColor = "@android:color/darker_gray"/>
                </LinearLayout>
            </android.support.v7.widget.CardView>
        </LinearLayout>
    </LinearLayout>
</android.support.v4.widget.NestedScrollView>

добавить файл activity_main6.xml

Pavya 15.05.2018 05:52
0
1
5 783
3

Ответы 3

Используйте пространство имен приложения (на сворачивающейся панели инструментов) Так что используйте,

 app:contentScrim = "@color/your_color"

вместо

 android:contentScrim

Вам нужно исправить три вещи, на которые указывает вам AAPT:

  • attr/actionBarSize is incompatible with attribute android:layout_height - вы передали строку вместо ссылки. Измените attr/actionBarSize на @attr/actionBarSize
  • android:srcCompact not found - такого понятия как srcCompact не существует :) замените android:srcCompact на android:srcCompat во всех четырех местах вашего activity_main6.xml
  • android:contentScrim not found - в пространстве имен android нет contentScrim. Вы, вероятно, имели в виду app:contentScrim, как @ santanu-sur уже указал в своем ответе.

Исправьте эти три проблемы, и он должен скомпилироваться.

Вы все это исправили? Если да, то сейчас вы, должно быть, получаете другие ошибки - возможно, похожие, но о других ресурсах или других файлах.

Izabela Orlowska 16.05.2018 12:02

Я удалил атрибут стиля из моего ВИДА, и проблема решена.

Другие вопросы по теме