【问题标题】:Cannot complete Gradle Build, failed linking references无法完成 Gradle 构建,链接引用失败
【发布时间】:2018-04-06 13:49:16
【问题描述】:

我下载了一个包含 3 个模块的项目,在尝试构建它之后,我从 gradlew assembleDebug--scan 得到以下信息:

处理资源失败,详见上面的 aapt 输出。

问题是,据我所知,在 build 文件夹中的 values.xml 文件中,这意味着我无法更改它。我究竟做错了什么?。

>error: style attribute '@android:attr/windowBackground' not found.
Message{kind=ERROR, text=error: style attribute '@android:attr/windowBackground' not found., sources=[C:\Users\Charorfa\Downloads\atlas-contentcollector-forgroup\ATLASContentCollector\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:253], original message=, tool name=Optional.of(AAPT)}

>error: style attribute '@android:attr/textColor' not found.
Message{kind=ERROR, text=error: style attribute '@android:attr/textColor' not found., sources=[C:\Users\Charorfa\Downloads\atlas-contentcollector-forgroup\ATLASContentCollector\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:254], original message=, tool name=Optional.of(AAPT)}

同步显示

配置“编译”已过时,已替换为“实施”。 将于 2018 年底移除

但我认为这更像是一个警告,而不是一个错误。

这个我也找到了,不知道能不能帮到我

error: failed linking references. -> QueuedJob

【问题讨论】:

    标签: android android-gradle-plugin


    【解决方案1】:

    这可能是因为您正在尝试为您的样式使用不存在的属性:

    @android:attr/windowBackground
    

    @android:attr/textColor
    

    相反,您需要使用android:windowBackgroundandroid:textColor,如下所示:

      <style name="DontCopyMyStyle" parent="AppTheme">
        <item name="android:windowBackground">@android:color/black</item>
        <item name="android:textColor">@android:color/white</item>
      </style>
    

    【讨论】:

    • 这不是问题,这里是有问题的代码: ` `
    • 删除@,并使用我回答中的属性。所以,应该是:&lt;style name="dialog_light" parent="@android:style/Theme.Dialog"&gt; &lt;item name="android:windowBackground"&gt;@android:color/background_light&lt;/item&gt; &lt;item name=android:textColor"&gt;@android:color/primary_text_light&lt;/item&gt; &lt;/style&gt;
    • 我做不到,values.xml 在构建文件夹中,它会自动更改
    • @Orcha:检查您的资源目录中的style.xml (res/)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-10
    • 2015-08-22
    • 2014-03-30
    相关资源
    最近更新 更多