
[英]Execution failed for task ':app:mergeReleaseResources' after generating bundle files
[英]Cannot generate app bundle... something with mergeReleaseResources
我正在尝试生成已签名的捆绑包来发布我的第一个应用程序,但我无法编译它,而且我已经查找了每个错误,但找不到答案。 这是错误消息:
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.
参考的原.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"
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>
当我查看它正在组装的文件时,它是这样的:
<?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>
解决方法是不删除资源....不删除gradle中的apcompability....
我解决了,但我真的不知道那是什么。 从头开始创建新项目并复制并粘贴每个活动。 运行它,生成签名包....就是这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.