0

while making a calculator app in android studio i wrote whole xml file the java file is untouched but when i tried to execute the file in my physical device the gradle build is getting failed

THIS IS MY .XML FILE

    <?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:backgroundTint="#FFEB3B"
    android:foregroundTint="#009688"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/plus"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginStart="12dp"
        android:backgroundTint="#ff4444"

        android:text="+"
        app:layout_constraintStart_toEndOf="@+id/three"
        tools:layout_editor_absoluteY="557dp" />

    <Button
        android:id="@+id/sqroot"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="√ "
        android:backgroundTint="#cc0000"
        tools:layout_editor_absoluteX="200dp"
        tools:layout_editor_absoluteY="636dp" />

    <Button
        android:id="@+id/one"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="1"
        android:backgroundTint="#cc0000"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="557dp" />

    <Button
        android:id="@+id/five"
        android:layout_width="78dp"
        android:layout_height="81dp"
        android:layout_marginEnd="12dp"
        android:backgroundTint="#cc0000"
        android:text="5"
        app:layout_constraintEnd_toStartOf="@+id/six"
        tools:layout_editor_absoluteY="476dp" />

    <Button
        android:id="@+id/square"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginEnd="4dp"
        android:backgroundTint="#cc0000"
        android:text="x²"
        app:layout_constraintEnd_toStartOf="@+id/zero"
        tools:layout_editor_absoluteY="636dp" />

    <Button
        android:id="@+id/four"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginEnd="8dp"
        android:backgroundTint="#cc0000"
        android:text="4"
        app:layout_constraintEnd_toStartOf="@+id/five"
        tools:layout_editor_absoluteY="476dp" />

    <Button
        android:id="@+id/zero"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginEnd="12dp"
        android:backgroundTint="#cc0000"
        android:text="0"
        app:layout_constraintEnd_toStartOf="@+id/sqroot"
        tools:layout_editor_absoluteY="636dp" />

    <Button
        android:id="@+id/two"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginEnd="8dp"
        android:backgroundTint="#cc0000"
        android:text="2"
        app:layout_constraintEnd_toStartOf="@+id/three"
        tools:layout_editor_absoluteY="557dp" />

    <Button
        android:id="@+id/three"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="3"
        android:backgroundTint="#cc0000"
        tools:layout_editor_absoluteX="200dp"
        tools:layout_editor_absoluteY="557dp" />

    <Button
        android:id="@+id/equal"
        android:layout_width="82dp"
        android:layout_height="78dp"
        android:layout_marginStart="12dp"
        android:backgroundTint="#ff4444"
        android:text="="
        app:layout_constraintStart_toEndOf="@+id/sqroot"
        tools:layout_editor_absoluteY="636dp" />

    <Button
        android:id="@+id/six"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="6"
        android:backgroundTint="#cc0000"
        tools:layout_editor_absoluteX="200dp"
        tools:layout_editor_absoluteY="478dp" />

    <Button
        android:id="@+id/minus"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginStart="12dp"
        android:backgroundTint="#ff4444"
        android:text="-"
        app:layout_constraintStart_toEndOf="@+id/six"
        tools:layout_editor_absoluteY="478dp" />

    <Button
        android:id="@+id/seven"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="7"
        android:backgroundTint="#cc0000"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="399dp" />

    <Button
        android:id="@+id/eight"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="8"
        android:backgroundTint="#cc0000"
        tools:layout_editor_absoluteX="106dp"
        tools:layout_editor_absoluteY="399dp" />

    <Button
        android:id="@+id/multiply"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="×"
        android:backgroundTint="#ff4444"
        tools:layout_editor_absoluteX="294dp"
        tools:layout_editor_absoluteY="399dp" />

    <Button
        android:id="@+id/nine"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="9"
        android:backgroundTint="#cc0000"
        tools:layout_editor_absoluteX="200dp"
        tools:layout_editor_absoluteY="399dp" />

    <Button
        android:id="@+id/ac"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:text="AC"
        android:backgroundTint="#ff4444"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="316dp" />

    <Button
        android:id="@+id/c"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginStart="4dp"
        android:backgroundTint="#ff4444"
        android:text="C"
        app:layout_constraintEnd_toStartOf="@+id/decimal"
        app:layout_constraintStart_toEndOf="@+id/ac"
        tools:layout_editor_absoluteY="316dp" />

    <Button
        android:id="@+id/decimal"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:backgroundTint="#ff4444"
        android:text="."
        tools:layout_editor_absoluteX="200dp"
        tools:layout_editor_absoluteY="316dp" />

    <Button
        android:id="@+id/divide"
        android:layout_width="83dp"
        android:layout_height="79dp"
        android:layout_marginStart="12dp"
        android:backgroundTint="#ff4444"
        android:text="/"
        app:layout_constraintStart_toEndOf="@+id/decimal"
        tools:layout_editor_absoluteY="316dp" />

    <EditText
        android:id="@+id/edittext"
        android:layout_width="343dp"
        android:layout_height="125dp"
        android:layout_marginTop="44dp"
        android:ems="10"
        android:inputType="numberDecimal"
        app:layout_constraintTop_toBottomOf="@+id/textView"
        tools:layout_editor_absoluteX="22dp" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="337dp"
        android:layout_height="52dp"
        android:text="AKSHIT'S CALCULATOR"
        android:backgroundTint="#ff4444"
        tools:layout_editor_absoluteX="22dp"
        tools:layout_editor_absoluteY="16dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

this is the exact error i am facing

Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.res.ParseLibraryResourcesTask$ParseResourcesRunnable

with this i got 7 more errors which are

Caused by: com.android.ide.common.symbols.ResourceDirectoryParseException: Failed to parse XML file 'C:\Users\akki kisu\AndroidStudioProjects\MyApplication2\app\build\intermediates\packaged_res\debug\drawable\buttonbgcolor.xml'`

Element type "color" must be followed by either attribute specifications, ">" or "/>".

Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable

Caused by: com.android.aaptcompiler.ResourceCompilationException: Resource compilation failed (Failed to compile resource file: C:\Users\akki kisu\AndroidStudioProjects\MyApplication2\app\src\main\res\drawable\buttonbgcolor.xml: . Cause: com.ctc.wstx.exc.WstxParsingException: Unexpected '<' character in element (missing closing '>'?)

Caused by: com.android.aaptcompiler.ResourceCompilationException: Failed to compile resource file: C:\Users\akki kisu\AndroidStudioProjects\MyApplication2\app\src\main\res\drawable\buttonbgcolor.xml: 

Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected '<' character in element (missing closing '>'?)

Element type "color" must be followed by either attribute specifications, ">" or "/>".

thankyou

0 Answers0