Cannot generate app bundle... something with mergeReleaseResources
Asked Answered
M

1

0

I'm trying to generate the signed bundle to publish my first app, but I cannot make it compile and I have look for every error and can't find an answer. This is the error message:

Task :app:mergeReleaseResources
 C:\Users\TNS SAS\AndroidStudioProjects\numBus\app\build\intermediates
   \incremental\mergeReleaseResources\stripped.dir\layout
   \activity_main.xml:17:53: Id 'id/ button' has an invalid entry name ' button'.
 C:\Users\TNS SAS\AndroidStudioProjects\numBus\app\build\intermediates
   \incremental\mergeReleaseResources\stripped.dir\layout
   \activity_main.xml: Failure to compile the resource file.

 Task :app:mergeReleaseResources FAILED
    Execution failed for task ':app:mergeReleaseResources'.
 A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
 Resource compilation failed. Check logs for details.

The original .xml that makes reference is this code:

<?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"
tools:context=".MainActivity">

<ImageView
    android:id="@+id/imageView"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginStart="40dp"
    android:layout_marginTop="20dp"
    android:layout_marginEnd="40dp"
    android:layout_marginBottom="20dp"
    android:contentDescription="logo"
    app:layout_constraintBottom_toTopOf="@+id/tvCedula"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/logo" />

<EditText
    android:id="@+id/tvCedula"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="16dp"
    android:ems="10"
    android:hint="Cédula"
    android:inputType="number"
    android:minHeight="48dp"
    android:textColorHighlight="@color/purple_500"
    android:textColorLink="@color/purple_200"
    app:layout_constraintBottom_toTopOf="@+id/tvPlaca"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.502"
    app:layout_constraintStart_toStartOf="parent"/>

<EditText
    android:id="@+id/tvPlaca"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="16dp"
    android:ems="10"
    android:hint="Placa"
    android:inputType="textAutoComplete"
    android:minHeight="48dp"
    app:layout_constraintBottom_toTopOf="@+id/spinnerEmpresas"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:textAllCaps="true" />

<Spinner
    android:id="@+id/spinnerEmpresas"
    android:layout_width="220dp"
    android:layout_height="48dp"
    android:layout_marginBottom="16dp"
    android:animationCache="false"
    android:dropDownWidth="wrap_content"
    android:ems="10"
    android:minHeight="48dp"
    android:spinnerMode="dropdown"
    app:layout_constraintBottom_toTopOf="@+id/sign_in_button"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    tools:ignore="SpeakableTextPresentCheck" />

<com.google.android.gms.common.SignInButton
    android:id="@+id/sign_in_button"
    android:layout_width="wrap_content"
    android:layout_height="55dp"
    android:layout_marginBottom="150dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

When I look at the file that it's assembling, it is this:

<?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"
tools:context=".MainActivity">
<com.google.android.gms.common.SignInButton
    android:id="@+id/ button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

The solution is not deleting resources.... not to delete apcompability in gradle....

Malvern answered 24/1, 2022 at 5:26 Comment(4)
The below file is it in build folder ?Malissa
yes sir. it says this is a build folder and should not be edited. This only happens when i try to build a signed bundle. I can launch it and install it.... but not genereate a signed bundle.Malvern
it also happens trying to generate the apk. i've tried to change de ids of the components and no luck.Malvern
so i notice that i was running on an old version of android studio.... updated everything and the error changed a little bit.... it points the same component but a diferent line. > Task :app:mergeReleaseResources C:\Users\TNS SAS\AndroidStudioProjects\numBus\app\build\intermediates\incremental\mergeReleaseResources\stripped.dir\layout\activity_main.xml:10:5: Id 'id/ button' has an invalid entry name ' button'. C:\Users\TNS SAS\AndroidStudioProjects\numBus\app\build\intermediates\incremental\mergeReleaseResources\stripped.dir\layout\activity_main.xml: Failure to compile the resource file.Malvern
M
-1

I solved but i dont really know what it was. Created new Project from scratch and copied and pasted every activity. Run it, generate signed bundle.... and that´s it.

Malvern answered 12/2, 2022 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.