Execution failing when trying to build, Below is the error
Execution failed for task ‘:app:checkReleaseDuplicateClasses’.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class androidx.work.OneTimeWorkRequestKt found in modules work-runtime-2.8.1-runtime (androidx.work:work-runtime:2.8.1) and work-runtime-ktx-2.7.1-runtime (androidx.work:work-runtime-ktx:2.7.1)
Duplicate class androidx.work.PeriodicWorkRequestKt found in modules work-runtime-2.8.1-runtime (androidx.work:work-runtime:2.8.1) and work-runtime-ktx-2.7.1-runtime (androidx.work:work-runtime-ktx:2.7.1)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
I tried force setting the version to 2.8.1 as its the latest stable version.
implementation("androidx.work:work-runtime-ktx:2.7.1:$androidxWorkWork"){ force = true }
defined $androidxWorkWork = "2.8.1"
Expected the classes would pick 2.8.1, but i see a new error where a particular package was not found.
Execution failed for task ‘:app:checkReleaseDuplicateClasses’.
Could not resolve all files for configuration ‘:app:releaseRuntimeClasspath’.
Failed to transform work-runtime-ktx-2.7.1-2.8.1.jar (androidx.work:work-runtime-ktx:2.7.1) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Could not find work-runtime-ktx-2.7.1-2.8.1.jar (androidx.work:work-runtime-ktx:2.7.1).
Searched in the following locations:
https://nexus.rbfcu.org/repository/maven-public/androidx/work/work-runtime-ktx/2.7.1/work-runtime-ktx-2.7.1-2.8.1.jar
Below are the dependencies of the app in build.gradle
dependencies {
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0"
implementation("androidx.work:work-runtime-ktx:2.7.1:$androidxWorkWork"){
force = true
Env: Ionic + Angular
Any suggestions on what can be done?
2
Answers
Figured out the issue.
in the dependencies, the version 2.7.1 was being added when pointing to 2.8.1.
Changed to
If I understand everything correctly, then adding a dependency in this format is incorrect. You have specified two versions of the library here at once.
The correct option would be:
or