Issue
I am trying to run all ui test for my app using jenkins ci/cd, but i constantly run into error, which cause by fail of app:processDebugResources command. When i build project at Android Studio it doesn't throw any error and build correctly.
After executing in jenkins connectedAndroidTest
gradle command :
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 appcompat-1.3.0.aar (androidx.appcompat:appcompat:1.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-3\9398b1795b0a45e239a8370198c80687\transformed\appcompat-1.3.0.
> Android resource compilation failed
ERROR:AAPT: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\5b50c60af17e66ade7be3083cf0fe04d\transformed\androidx.appcompat: error: Не удается найти указанный файл. (2).
> Failed to transform appcompat-1.3.0.aar (androidx.appcompat:appcompat:1.3.0) 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\9398b1795b0a45e239a8370198c80687\transformed\appcompat-1.3.0.
> Android resource compilation failed
ERROR:AAPT: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\5b50c60af17e66ade7be3083cf0fe04d\transformed\androidx.appcompat: error: Не удается найти указанный файл. (2).
> Failed to transform core-1.6.0.aar (androidx.core:core:1.6.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-3\619c06b67a6c841ffa9224727d661a21\transformed\core-1.6.0.
> Android resource compilation failed
ERROR:AAPT: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\308760ecdbed89bb153e932d840e53f3\transformed\androidx.core: error: Не удается найти указанный файл. (2).
Error Failed to transform core-1.6.0.aar repeat several times in report, but error text are the same every time.
My build.gradle:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
id 'com.shazam.fork'
}
apply plugin: 'com.shazam.fork'
android {
compileSdkVersion 30
defaultConfig {
configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
}
applicationId "app.converter" // it's ok, nevermind
minSdkVersion 30
//noinspection OldTargetApi
targetSdkVersion 30
versionCode 5
versionName "5"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
buildFeatures {
viewBinding true
}
}
}
dependencies {
....
//noinspection GradleDependency
implementation 'androidx.appcompat:appcompat:1.3.0'
....
implementation 'androidx.core:core-ktx:1.6.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
}
Thanks in advance, will provide additional info on request.
UPD :
Adding -g C:\gradle-cache
to gradle tasks in Jenkins triggered a new error:
22:14:03 * What went wrong:
22:14:03 Execution failed for task ':app:processDebugAndroidTestResources'.
22:14:03 > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
22:14:03 > Android resource linking failed
22:14:03 C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\ConverterKT\app\build\intermediates\packaged_manifests\debugAndroidTest\AndroidManifest.xml: error: failed to load XML file: Не удается найти указанный файл. (2).
UPD 2. Updated gradle to 7.5 and addtional exception show up, however termial run in Android Studio
21:01:23 FAILURE: Build completed with 2 failures.
21:01:23
21:01:23 1: Task failed with an exception.
21:01:23 -----------
21:01:23 * What went wrong:
21:01:23 Execution failed for task ':app:processDebugResources'.
21:01:23 > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
21:01:23 > Android resource linking failed
21:01:23 C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\ConverterKT\app\build\intermediates\packaged_manifests\debug\AndroidManifest.xml: error: failed to load XML file: Не удается найти указанный файл. (2).
21:01:23
21:01:23
21:01:23 * Try:
21:01:23 > Run with --stacktrace option to get the stack trace.
21:01:23 > Run with --info or --debug option to get more log output.
21:01:23 > Run with --scan to get full insights.
21:01:23 ==============================================================================
21:01:23
21:01:23 2: Task failed with an exception.
21:01:23 -----------
21:01:23 * What went wrong:
21:01:23 Execution failed for task ':app:processDebugAndroidTestResources'.
21:01:23 > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
21:01:23 > Android resource linking failed
21:01:23 C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\ConverterKT\app\build\intermediates\packaged_manifests\debugAndroidTest\AndroidManifest.xml: error: failed to load XML file: Не удается найти указанный файл. (2).
Solution
(One of) the AndroidManifest.xml
seems to be corrupt. One can write <?xml version="1.0" encoding="utf-8"?>
into just any XML file, while the file itself doesn't feature UTF-8 encoding, this does not matter the least. Or plugin id 'kotlin-parcelize'
might be related; usually this one is not required. I'd also suggest to get rid of this, unless there is a good reason:
configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
}
While it won't even build locally, forget about building on Jenkins.
Answered By - Martin Zeitler
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.