繁体   English   中英

在 TeamCity 上使用 Gradle 构建时失败:Task:app:processDebugResources FAILED

[英]Fail while build with Gradle on TeamCity: Task :app:processDebugResources FAILED

我在命令行中通过 Gradle 构建器构建了我的 Android 项目:

Gradlew build

一切正常:

BUILD SUCCESSFUL in 4s
54 actionable tasks: 1 executed, 53 up-to-date

但是在同一个项目、同一个环境中,在 TeamCity 中构建时会出错:

Execution failed for task ':app:processDebugResources'. org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.'

很多很多文物都没有像这样找到:

What went wrong:
[org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:processDebugResources'.
[org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
[org.gradle.internal.buildevents.BuildExceptionReporter]    > Failed to transform artifact 'appcompat.aar (androidx.appcompat:appcompat:1.1.0)' to match attributes {artifactType=android-compiled-dependencies-resources}.
[org.gradle.internal.buildevents.BuildExceptionReporter]       > Execution failed for AarResourcesCompilerTransform: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\f7fa931c10060cb31b4ececcd856b65d\appcompat-1.1.0.
[org.gradle.internal.buildevents.BuildExceptionReporter]          > Android resource compilation failed
[org.gradle.internal.buildevents.BuildExceptionReporter]            AAPT: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\7340c553bf3aabb8e86abd5cba76d4e6\androidx.appcompat: error: The system cannot find the file specified. (2).

我尝试运行clean buildbuild命令,但它不起作用。

我还在 Gradle.properties 中添加了一行来关闭 gradle 守护进程:

add org.gradle.daemon=false

gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Build.gradle:

dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1

可能是因为该项目位于远程 GitHub 并且需要额外的脚本? 在此处输入图像描述

我有一个类似的问题,并通过将以下参数添加到我的 Teamcity 项目中来解决它。

环境变量
JAVA_HOME - 本地计算机上 Java JDK 的路径 D:\Android Studio\jre

ANDROID_HOME - 本地计算机上 Android SDK 的路径
C:\Users\kelvin\AppData\Local\Android\Sdk

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM