描述:我创建了一个 jenkins 作业,将 jenkins 与 Android Studio 集成以生成工件,
在Android Studio中构建项目时,构建成功..
但是当我通过 jenkins 构建相同的项目时,我收到以下错误..!
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :clean UP-TO-DATE
> Task :app:clean UP-TO-DATE
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:javaPreCompileDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :app:processDebugManifest
> Task :app:mergeDebugResources
> Task :app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform navigation-ui-2.3.0.aar (androidx.navigation:navigation-ui:2.3.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AarResourcesCompilerTransform: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\d0f92c0b26fabb47a28488bab3cc8456\navigation-ui-2.3.0.
> Android resource compilation failed
AAPT: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\9db20844a7f2758cbc14bea528bced6c\androidx.navigation.ui: error: The system cannot find the file specified. (2).
任何帮助表示赞赏..!
我解决了这个问题,这是 gradle 缓存问题。所以我只是在配置系统的环境变量中添加了 gradle 路径“GRADLE_USER_HOME”,并在全局工具配置中保留了 gradle 设置。通过这个我们告诉 gradle 哪个目录用于它的缓存。
检查一次配置...
如果您正确配置了上述内容,您将不会收到错误,
解决方案
然后在 Jenkins 中运行作业
你肯定会在詹金斯工作中获得蓝色成功球