[英]How do I read “failed linking file resources” error messages?
I get these regularly and spontaneously and I am never able to deliberately solve them. 我会定期和自发地获得这些信息,而我永远无法刻意解决它们。 Here is the build log: 这是构建日志:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
Output: X:\Documents\All\Creative\Programming\Projects\Theo\app\src\main\res\layout\activity_login.xml:74: error: resource integer/login (aka org.andrewedgar.theo:integer/login) not found.
error: failed linking file resources.
I see a reference to one of my activity layouts (activity_login), but I haven't touched that file or its corresponding class in weeks. 我看到了对我的一个活动布局(activity_login)的引用,但是几周内我都没有触及该文件或其对应的类。 There's nothing even on line 74 there: 甚至第74行也没有任何内容:
<android.support.constraint.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:background="@color/colorPrimary"
android:gravity="bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="org.andrewedgar.theo.LoginActivity">
<ImageView
android:id="@+id/imageView2"
android:layout_width="286dp"
android:layout_height="100dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="@+id/textInputLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/logo" />
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:textColorHint="@color/hintColor"
app:layout_constraintBottom_toTopOf="@+id/textInputLayout2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<AutoCompleteTextView
android:id="@+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/nunito"
android:hint="@string/prompt_email"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:maxLines="1"
android:textColor="@color/white"
android:textColorHint="@color/hintColor"
android:textIsSelectable="false" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:textColorHint="@color/hintColor"
app:layout_constraintBottom_toTopOf="@+id/login_sign_in_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<EditText
android:id="@+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/nunito"
android:hint="@string/prompt_password"
android:imeActionId="@integer/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:textColor="@color/white"
android:textColorHint="@color/hintColor" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/login_sign_in_button"
style="?android:textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:background="@android:color/background_light"
android:fontFamily="@font/nunito_bold"
android:onClick="signInExistingUser"
android:text="@string/action_sign_in_short"
android:textColor="@color/colorPrimary"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/login_register_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/login_register_button"
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:background="@color/colorPrimary"
android:fontFamily="@font/nunito_bold"
android:onClick="registerNewUser"
android:text="@string/action_register"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
Reverting back to an a version that worked when I committed it didn't solve the problem either. 恢复到我提交时可以使用的版本也不能解决问题。 Invalidate Caches/Restart and Clean/Rebuild does not work. 使缓存无效/重新启动,并且清理/重建无效。 Is there a typical solution to this type of error? 有没有针对此类错误的典型解决方案?
error: resource integer/login (aka org.andrewedgar.theo:integer/login) not found
. error: resource integer/login (aka org.andrewedgar.theo:integer/login) not found
。 It looks like you used to have this resource, but now you don't have it. 看起来您曾经拥有此资源,但是现在您没有它。
You need to remove @integer/login
and to do clean
and build
. 您需要删除@integer/login
并进行clean
和build
。 If it not help, do: 如果没有帮助,请执行以下操作:
File -> Invalidate Caches/Restart 文件->使缓存无效/重新启动
Or you just can add login resources into your xml file in values
folder. 或者,您可以将登录资源添加到values
文件夹中的xml文件中。
You are referencing an attribute "@integer/login"
that most probably doesn't exist in your project. 您所引用的属性"@integer/login"
很可能在您的项目中不存在。 In fact, the error stated the following: 实际上,该错误表明以下内容:
error: resource integer/login (aka org.andrewedgar.theo:integer/login) not found.
Generally, this type of errors are related to xml and points that you are using an attribute somewhere that is not recognized. 通常,这种类型的错误与xml有关,并且指出您在无法识别的地方使用属性。
resource
integer/login
not found. 找不到资源integer/login
。
how about to add the missing resource, of type integer
with name login
? 如何添加名称为login
integer
类型的丢失资源?
eg. 例如。 with a res/values/numerical.xml
alike: 与res/values/numerical.xml
一样:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="login">1</integer>
</resources>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.