错误:链接引用失败。 - > QueuedJob

时间:2018-01-23 16:11:56

标签: android kotlin android-gradle android-appcompat floating-action-button

我正在使用Kotlin研究Android Material Design,一切顺利,直到我尝试使用android.support.design.widget.FloatingActionButton。

当我重建项目时,我收到以下错误消息:

Information:Gradle tasks [clean, :app:assembleDebug]
C:\Users\qin\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\3d5ddc383685b19d22429a29e09f2aeb\res\values\values.xml
Error:(1419, 5) error: style attribute 'attr/textColor (aka br.com.conseng.themedesign:attr/textColor)' not found.
Error:(1525, 5) error: style attribute 'attr/textColor (aka br.com.conseng.themedesign:attr/textColor)' not found.
.....\CursoMaterialDesign\ThemeDesign\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:(1843) style attribute 'attr/textColor (aka br.com.conseng.themedesign:attr/textColor)' not found.
Error:(1953) style attribute 'attr/textColor (aka br.com.conseng.themedesign:attr/textColor)' not found.
Error:failed linking references.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 15s
Information:9 errors
Information:0 warnings
Information:See complete output in console

我将源文件保存在GitHub上,我的环境是:

  • WINDOWS 10 10.03.0.1(64位)
  • ANDROID STUDIO Android Studio 3.0.1 - Build#AI-171.4443003
  • JRE:1.8.0_152-release-915-b01 amd64
  • JVM:JetBrains s.r.o
  • 的OpenJDK 64位服务器VM

我试过了:

  1. FILE-> INVALIDATE CACHE / RESTART命令,但没有任何更改。
  2. 我在终端上执行了 gradlew cleanBuildCache ,但它无法确定“9.0.1”(?)中的java版本,如下所示。
  3. gradlew cleanBuildCache --stacktrace --debug
    14:05:14.966 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: C:\Users\qin\.gradle\native
    14:05:15.038 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    14:05:15.039 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
    14:05:15.039 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    14:05:15.039 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
    14:05:15.042 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not determine java version from '9.0.1'.
    14:05:15.042 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    14:05:15.042 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
    14:05:15.043 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] java.lang.IllegalArgumentException: Could not determine java version from '9.0.1'.
    14:05:15.043 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:72)
    14:05:15.043 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.JavaVersion.current(JavaVersion.java:82)
    14:05:15.043 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.jvm.UnsupportedJavaRuntimeException.assertUsingVersion(UnsupportedJavaRuntimeEx
    ception.java:29)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:32)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:
    253)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:
    182)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.Main.doAction(Main.java:33)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    14:05:15.044 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
    a:43)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    14:05:15.045 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
    a:43)
    14:05:15.046 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    14:05:15.046 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    14:05:15.046 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
    14:05:15.046 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
    14:05:15.046 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    14:05:15.046 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    14:05:15.046 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
    

5 个答案:

答案 0 :(得分:18)

您正在引用一个属性" textColor",它应该是" android:textColor"。
在app / src / main / res / values / styles.xml中替换第13行和第17行:

<item name="textColor">...</item> -> <item name="android:textColor">...</item>

如何:AAPT的错误说明如下:

  

错误:样式属性&#39; attr / textColor(又名br.com.conseng.themedesign:attr / textColor)&#39;没找到。

它指出您(或您的库)正在使用某个无法识别的属性。我搜索了&#34; textColor&#34;在您的存储库中,并提出了名为&#34; textColor&#34;的两个属性。广泛使用的属性是&#34; android:textColor&#34;并且你没有定义属性&#34; textColor&#34;在你自己的任何地方,所以看起来你错过了&#34; android:&#34;前缀。

答案 1 :(得分:1)

我刚刚删除了我的颜色资源,但是它已用于我的样式中。因此,Ctrl+Shift+F检查您的颜色是否真的没有在任何地方使用。

答案 2 :(得分:1)

从gradle构建文件中的dependencies中删除此行:

implementation 'com.android.support.constraint:constraint-layout:+'

答案 3 :(得分:0)

对于我的情况,我在build.gradle中的compileSdkVersion = targetSdkVersion。

答案 4 :(得分:0)

转到build.gradle(app)并将其添加为依赖项:

implementation 'com.android.support:appcompat-v7:28.0.0'

现在我的compileSdkVersion28,所以是28.0.0

尝试并据此进行更改。