Descrip : I created a jenkins job to integrate jenkins with Android studio for generating artifacts,
While building the project in Android studio, The build is successfull..
But When i build the same project via jenkins, Im getting the below error..!
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).
Any help appreciated..!
Best Answer
I resoved this issue, it's gradle cache problem. So i just added the gradle path "GRADLE_USER_HOME" in Environment variable of Configure system and let keep the gradle setting in Global Tool configuration. Through this we tell the gradle which directory to use for it's cache.