Execution failed for task ‘:app:mergeDebugResources’ A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable

I just made changes in the values ​​resource directory, not able to figure out why this error occured.

I don’t have any corruptable drawable file

Here is the complete LOG:

I made changes in the styles.xml under the values ​​directory:-

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

    <style name="pair_device_card_bg">
        <item name="cardBackgroundColor">@color/transparent_87</item>
        <item name="android:layout_marginTop">@dimen/margin_16</item>
        <item name="cardCornerRadius">@dimen/corner_radius</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:elevation">@dimen/spacing_2</item>
    </style>

    <style name="pink_title">
        <item name="android:textColor">@color/colorPrimary</item>
        <item name="android:layout_marginStart">@dimen/margin_16</item>
        <item name="android:paddingTop">@dimen/spacing_2</item>
        <item name="android:paddingBottom">@dimen/spacing_2</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
    </style>

    <style name="white_title">
        <item name="android:textColor">@color/white_title</item>
        <item name="android:layout_marginStart">@dimen/margin_16</item>
        <item name="android:paddingTop">@dimen/spacing_2</item>
        <item name="android:paddingBottom">@dimen/spacing_2</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:fontFamily">@font/lato</item>
        <item name="android:textSize">@dimen/text_18</item>
        <item name="android:letterSpacing">0.01</item>
    </style>

    <style name="text_desc">
        <item name="android:textColor">@color/white_text_desc</item>
        <item name="android:layout_marginStart">@dimen/margin_16</item>
        <item name="android:paddingTop">@dimen/spacing_4</item>
        <item name="android:paddingBottom">@dimen/spacing_4</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:fontFamily">@font/lato_regular</item>
        <item name="android:textSize">@dimen/text_14</item>
        <item name="android:letterSpacing">0.03</item>
    </style>

    <style name="icon">
        <item name="android:layout_height">@dimen/spacing_40</item>
        <item name="android:layout_width">@dimen/spacing_40</item>
        <item name="contentDescription">@string/pair_device_icon</item>
    </style>

    <style name="title_fragment">
        <item name="android:textColor">@color/white_title</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:fontFamily">@font/lato_bold</item>
        <item name="android:textSize">@dimen/text_36</item>
        <item name="android:letterSpacing">0.01</item>
        <item name="android:lineSpacingExtra">@dimen/spacing_4</item>
    </style>

    <style name="white_title_2">
        <item name="android:textColor">@color/white_title</item>
        <item name="android:layout_marginBottom">@dimen/spacing_8</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textSize">@dimen/text_18</item>
    </style>

    <style name="primary_btn">
        <item name="android:background">@drawable/primary_button_bg</item>
        <item name="android:textAllCaps">false</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textSize">@dimen/text_18</item>
    </style>

    <style name="constraint_ll">
        <item name="android:background">@color/background_dark</item>
        <item name="android:paddingStart">@dimen/spacing_24</item>
        <item name="android:paddingEnd">@dimen/spacing_24</item>
        <item name="android:paddingTop">@dimen/spacing_32</item>
        <item name="android:paddingBottom">@dimen/spacing_32</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:textSize">@dimen/text_18</item>
    </style>
</resources>

and also made changes in the dimens.xml also under the value directory

<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="nav_header_vertical_spacing">8dp</dimen>
    <dimen name="nav_header_height">176dp</dimen>
    <dimen name="fab_margin">16dp</dimen>

    <dimen name="actionBarSize">56dp</dimen>
    <dimen name="viewpager_margin_overlap">-60dp</dimen>
    <dimen name="viewpager_margin_overlap_payment">-30dp</dimen>

    <!--general spacing-->
    <dimen name="spacing_2">2dp</dimen>
    <dimen name="spacing_4">4dp</dimen>
    <dimen name="spacing_medium">5dp</dimen>
    <dimen name="spacing_8">8dp</dimen>
    <dimen name="spacing_middle">10dp</dimen>
    <dimen name="spacing_16">16dp</dimen>
    <dimen name="spacing_18">18dp</dimen>
    <dimen name="spacing_20">20dp</dimen>
    <dimen name="spacing_24">24dp</dimen>
    <dimen name="spacing_32">32dp</dimen>
    <dimen name="spacing_40">40dp</dimen>
    <dimen name="spacing_50">50dp</dimen>
    <dimen name="spacing_55">55dp</dimen>
    <dimen name="appbar_padding_top">8dp</dimen>
    <dimen name="corner_radius">4dp</dimen>
    <dimen name="margin_16">16dp</dimen>
    <dimen name="text_18">18sp</dimen>
    <dimen name="text_14">14sp</dimen>
    <dimen name="text_36">36sp</dimen>


    <dimen name="placeholder_text_height">8dp</dimen>
    <dimen name="letter_spacing">0.03</dimen>

</resources>

The fragment in which I am applying those styles fragment_pair_device.xml :-

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    style="@style/constraint_ll"
    tools:context=".ui.pairDevice.PairDeviceFragment">

    <TextView
        android:id="@+id/textView"
        style="@style/title_fragment"
        android:text="@string/pair_your_device"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.cardview.widget.CardView
        android:id="@+id/cvStep1"
        style="@style/pair_device_card_bg"
        android:layout_marginTop="24dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/clStep1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="12dp">

            <ImageView
                android:id="@+id/ivStep1"
                style="@style/icon"
                android:src="@drawable/ic_bluetooth"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tvStep1"
                style="@style/pink_title"
                android:text="Step 1"
                app:layout_constraintStart_toEndOf="@+id/ivStep1"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tvStep1Title"
                style="@style/white_title"
                android:text="Turn On Your bluetooth"
                app:layout_constraintStart_toEndOf="@+id/ivStep1"
                app:layout_constraintTop_toBottomOf="@id/tvStep1" />

            <TextView
                android:id="@+id/tvStep1Desc"
                style="@style/text_desc"
                android:text="@string/step_1_desc"
                app:layout_constraintStart_toEndOf="@+id/ivStep1"
                app:layout_constraintTop_toBottomOf="@id/tvStep1Title" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/cvStep2"
        style="@style/pair_device_card_bg"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/cvStep1">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/clStep2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="12dp">

            <ImageView
                android:id="@+id/ivStep2"
                style="@style/icon"
                android:src="@drawable/ic_bluetooth"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tvStep2"
                style="@style/pink_title"
                android:text="@string/step_2"
                app:layout_constraintStart_toEndOf="@+id/ivStep2"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tvStep2Title"
                style="@style/white_title"
                android:fontFamily="@font/lato"
                android:text="@string/turn_on_your_popdot"
                app:layout_constraintStart_toEndOf="@+id/ivStep2"
                app:layout_constraintTop_toBottomOf="@id/tvStep2" />

            <TextView
                android:id="@+id/tvStep2Desc"
                style="@style/text_desc"
                android:text="@string/step_2_desc"
                app:layout_constraintStart_toEndOf="@+id/ivStep2"
                app:layout_constraintTop_toBottomOf="@id/tvStep2Title" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/cvStep3"
        style="@style/pair_device_card_bg"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/cvStep2">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/clStep3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="12dp">

            <ImageView
                android:id="@+id/ivStep3"
                style="@style/icon"
                android:src="@drawable/ic_bluetooth"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tvStep3"
                style="@style/pink_title"
                android:text="@string/step_3"
                app:layout_constraintStart_toEndOf="@+id/ivStep3"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tvStep3Title"
                style="@style/white_title"
                android:text="@string/pairing_mode_on"
                app:layout_constraintStart_toEndOf="@+id/ivStep3"
                app:layout_constraintTop_toBottomOf="@id/tvStep3" />

            <TextView
                android:id="@+id/tvStep3Desc"
                style="@style/text_desc"
                android:text="@string/step_3_desc"
                app:layout_constraintStart_toEndOf="@+id/ivStep3"
                app:layout_constraintTop_toBottomOf="@id/tvStep3Title" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.cardview.widget.CardView>

    <TextView
        style="@style/white_title_2"
        android:text="@string/all_set_time_to_connect_the_dots"
        app:layout_constraintBottom_toTopOf="@+id/btnPairDevice"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />


    <com.google.android.material.button.MaterialButton
        android:id="@+id/btnPairDevice"
        style="@style/primary_btn"
        android:text="@string/pair_device"
        app:backgroundTint="@null"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

It took me an hour in optimizing the UI. Your help is appreciated a lot, much thanks in advance

Leave a Comment