I am trying to build an android project with Jenkins. Everything works when I do it from the Android Studio but when I try to execute this pipeline:
pipeline {
agent any
options {
// Stop the build early in case of compile or test failures
skipStagesAfterUnstable()
}
stages {
stage('Build') {
steps {
git url: 'git project', branch: 'dev',
credentialsId: 'my id'
}
}
stage('Compile') {
steps {
sh './gradlew app:compileDevelopmentDebugSources'
}
}
}
}
Almost everything is compiling but then at the end it results in:
* What went wrong:
Execution failed for task ':app:processDevelopmentDebugResources'.
Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
Failed to transform appcompat-1.3.1.aar (androidx.appcompat:appcompat:1.3.1) 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-3\9e32ce413d257d430ee86cf55f3ee638\transformed\appcompat-1.3.1.
> Android resource compilation failed
ERROR:AAPT: C:\Windows\System32\config\systemprofile.gradle\caches\transforms-3\6f89bc5bb3a2c965d5a4f83c7a248dca\transformed\androidx.appcompat: error: The system cannot find the file specified. (2).
Failed to transform core-1.8.0-rc01.aar (androidx.core:core:1.8.0-rc01) 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-3\88b483c698053fa2a8111125a6a5e48d\transformed\core-1.8.0-rc01.
> Android resource compilation failed
ERROR:AAPT: C:\Windows\System32\config\systemprofile.gradle\caches\transforms-3\ed6fb526d8841f8ccb993b181101e77a\transformed\androidx.core: error: The system cannot find the file specified. (2).
Failed to transform core-1.8.0-rc01.aar (androidx.core:core:1.8.0-rc01) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: C:\Windows\System32\config\systemprofile.gradle\caches\transforms-3\88b483c698053fa2a8111125a6a5e48d\transformed\core-1.8.0-rc01.
> Android resource compilation failed
ERROR:AAPT: C:\Windows\System32\config\systemprofile.gradle\caches\transforms-3\ed6fb526d8841f8ccb993b181101e77a\transformed\androidx.core: error: The system cannot find the file specified. (2).
Failed to transform core-1.8.0-rc01.aar (androidx.core:core:1.8.0-rc01) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: C:\Windows\System32\config\systemprofile.gradle\caches\transforms-3\88b483c698053fa2a8111125a6a5e48d\transformed\core-1.8.0-rc01.
> Android resource compilation failed
ERROR:AAPT: C:\Windows\System32\config\systemprofile.gradle\caches\transforms-3\ed6fb526d8841f8ccb993b181101e77a\transformed\androidx.core: error: The system cannot find the file specified. (2).
I honestly have no idea what the issue might be because as I said it's building/running from the Android Studio.
It turns out this issue can be fixed by adding GRADLE_USER_HOME inside Jenkins.
Here are useful links:
I saw the answer from here:
https://serverfault.com/questions/1026538/jenkins-integration-with-android-studio
Similar issue:
Jenkins - Execution failed for task ':app:mergeDebugResources'
I tried this solution.
Locate Gradle manually.
navigate to configure jenkins and add a variable with the name of GRADLE_USER_HOME and value of C:\Users<username>.gradle (Windows)
Related
I am facing this issue and i don't know what to do. I am on ubuntu (popos) and i am using flutter 3.3.9. Thanks to everyone!
'''FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':firebase_messaging:parseDebugLocalResources'.
Could not resolve all files for configuration ':firebase_messaging:androidApis'.
Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for PlatformAttrTransform: /home/handgull/Android/Sdk/platforms/android-33/android.jar.
> /home/handgull/Android/Sdk/platforms/android-33/android.jar
'''
I have already tried to delete the ~/.gradle folder, to upgrade android-studio and other things.
I ran into this error when i tried to build a flutter project after add Square_reader_plugin_sdk pluggin
`Execution failed for task ':square_reader_sdk:compileDebugJavaWithJavac'.
Could not resolve all files for configuration ':square_reader_sdk:debugCompileClasspath'.
Failed to transform moshi-1.13.0.jar (com.squareup.moshi:moshi:1.13.0) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api, org.jetbrains.kotlin.platform.type=jvm}.
> Execution failed for JetifyTransform: /home/starburst/.gradle/caches/modules-2/files-2.1/com.squareup.moshi/moshi/1.13.0/da685586facab9eb5c4fb630ce248be14e7da21b/moshi-1.13.0.jar.
> Failed to transform '/home/starburst/.gradle/caches/modules-2/files-2.1/com.squareup.moshi/moshi/1.13.0/da685586facab9eb5c4fb630ce248be14e7da21b/moshi-1.13.0.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 60. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
Failed to transform bcprov-jdk15on-1.70.jar (org.bouncycastle:bcprov-jdk15on:1.70) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
> Execution failed for JetifyTransform: /home/starburst/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.70/4636a0d01f74acaf28082fb62b317f1080118371/bcprov-jdk15on-1.70.jar.
> Failed to transform '/home/starburst/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.70/4636a0d01f74acaf28082fb62b317f1080118371/bcprov-jdk15on-1.70.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
`
My gradle.properties has enable androidx and jettifier
org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true
i tries other solution from other thread but nothing seems to work
Flutter is failing build for one single project, the same project is working fine on other team members, and I am able to run other projects on my machine too.
Tried flutter pub cache repair, dart pub cache repair, cleaning the project, recloning, invalidating the cache from android studio. Nothing worked. Has anyone faced the same issue? I am using flutter 3.0.3
Failed to transform lifecycle-common-java8-2.2.0.jar (androidx.lifecycle:lifecycle-common-java8:2.2.0) to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-incremental-transform=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: C:\Users\jainh.gradle\caches\modules-2\files-2.1\androidx.lifecycle\lifecycle-common-java8\2.2.0\cd3478503da69b1a7e0319bd2d1389943db9b364\lifecycle-common-java8-2.2.0.jar.
Failed to transform common-27.0.1.jar (com.android.tools:common:27.0.1) to match attributes {artifactType=android-classes, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
> Execution failed for JetifyTransform: C:\Users\MyPc\.gradle\caches\modules-2\files-2.1\com.android.tools\common\27.0.1\62d59d2a0ee7d0cd7bbeba97ddce45f7898ec6c6\common-27.0.1.jar.
> Failed to transform 'C:\Users\MyPc\.gradle\caches\modules-2\files-2.1\com.android.tools\common\27.0.1\62d59d2a0ee7d0cd7bbeba97ddce45f7898ec6c6\common-27.0.1.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
Failed to transform bundletool-0.13.2.jar (com.android.tools.build:bundletool:0.13.2) to match attributes {artifactType=android-classes, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
> Execution failed for JetifyTransform: C:\Users\MyPc\.gradle\caches\modules-2\files-2.1\com.android.tools.build\bundletool\0.13.2\bb629ece022e5aa20cff66517e728c89f9667721\bundletool-0.13.2.jar.
> Failed to transform 'C:\Users\MyPc\.gradle\caches\modules-2\files-2.1\com.android.tools.build\bundletool\0.13.2\bb629ece022e5aa20cff66517e728c89f9667721\bundletool-0.13.2.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries
using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
Execution failed for task ':app:preDebugBuild'.
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Failed to transform artifact 'xxx.aar (project :xxx)' to match attributes {artifactType=android-manifest}
Execution failed for JetifyTransform: G:\android studio e\ChainStore-ManagementApp\chainstore-managmentApp\xxx\xxx.aar.
Failed to transform 'G:\android studio e\ChainStore-ManagementApp\chainstore-managmentApp\xxx\xxx.aar' using Jetifier. Reason: 5. (Run with --stacktrace for more details.)