I am getting this build error while I am trying to run my application from Android Studio.
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.measurement.zzbs found in modules jetified-play-services-measurement-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement:18.0.1) and jetified-play-services-measurement-sdk-api-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-sdk-api:18.0.3)
Duplicate class com.google.android.gms.internal.measurement.zzl found in modules jetified-play-services-measurement-impl-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:18.0.1) and jetified-play-services-measurement-sdk-api-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-sdk-api:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzfh found in modules jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:18.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzgl found in modules jetified-play-services-measurement-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement:18.0.1) and jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgm found in modules jetified-play-services-measurement-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement:18.0.1) and jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgn found in modules jetified-play-services-measurement-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement:18.0.1) and jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgo found in modules jetified-play-services-measurement-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement:18.0.1) and jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgp found in modules jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:18.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzgq found in modules jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:18.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhs found in modules jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:18.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhx found in modules jetified-play-services-measurement-base-18.0.3-runtime.jar (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:18.0.1)
This only happens after I update ads dependencies to the latest version.
From :
implementation 'com.google.android.gms:play-services-ads:20.0.0'
To :
implementation 'com.google.android.gms:play-services-ads:20.4.0'
If I change it back to 20.0.0 then it's working fine. I think the problem is with the latest version 20.4.0.
Can anybody help me please? Thanks in advance.
The release notes are not giving a hint.
I ended up using 20.3.0 for now which does not produce this error.
Another Google owned library has a conflicting version of com.google.android.gms:play-services-measurement-base installed. In my case it was Firebase Analytics.
Firebase Analytics
+--- com.google.firebase:firebase-analytics:18.0.0
| +--- com.google.android.gms:play-services-measurement:18.0.0
Play Services Ads
+--- com.google.android.gms:play-services-ads:20.6.0
| +--- com.google.android.gms:play-services-ads-lite:20.6.0
| | +--- com.google.android.gms:play-services-measurement-sdk-api:18.0.3
| | | \--- com.google.android.gms:play-services-measurement-base:18.0.3
After upgrading Firebase Analytics from version 18.0.0 to 20.1.2 it solved the issue.
To determine which library is conflicting in your project, output your dependency tree and find which library also installs com.google.android.gms:play-services-measurement-base. Then upgrade that library to the latest version.
See also
Duplicate class com.google.android.gms.internal.measurement.zzdu found in modules classes.jar com.google.android.gms:play-services-measurement-impl:
com.google.android.gms:play-services-measurement-base is being requested by various other libraries
Fix dependency resolution errors
View module dependencies
Related
I am getting the following error when Gradle is set 7.2.2.
Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
This is not in my program but in Android Studio.
How do I correct the problem?
Thanks,
Bill
In your build.gradle try adding this:
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"
This worked for me.
I added it but no change.
Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.1-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.1)
This error is caused by duplication of dependencies
To solve the same:
You must open Gradle Scripts-->build.gradle(Module: YourApp)
Or
You can just choose to search the builder:app file in Navigate--> Search Everywhere, type "build.gradle " and choose the option that appears build.gradle (: app)
Inside your build.gradle file it checks which of the implementations made in the dependencies tag was duplicated and deletes one of them.
Now
rebuild your app and good work!
I am trying to use AWS Amplify, and Android Navigation with Safe Args for Java. My project compiles properly, but crashes at runtime. The error indicates that the problem lies in the navigation classes, and playing with the modules I was using I found out that the other module causing the conflict is the one for AWS Amplify. I read on the Official website that I should in this case remove the navigation library since it seems to already be included in the Amplify library. Can I still use the Navigator if I remove the implementation lines in my gradle files? Is there another way to fix this? The objective is just to be able to use both Navigation and Amplify in the same project. Thank you for the help :)
I am using Android Studio Bumblebee 2021.1.1 Patch 3 and my project is for Android 8.1 (Oreo).
My app level build.gradle file is
plugins {
id 'com.android.application'
// Safe Args
id 'androidx.navigation.safeargs'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.myApplication"
minSdk 27
targetSdk 31
versionCode 1
versionName "0.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
// Support for Java 8 features (Amplify)
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// Navigation
def nav_version = "2.4.2"
// Java language implementation
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation "androidx.navigation:navigation-fragment:$nav_version"
// Lottie
def lottie_version = "5.0.3"
implementation "com.airbnb.android:lottie:$lottie_version"
// Amplify core dependency
def amplify_version = "1.35.3"
implementation "com.amplifyframework:core:$amplify_version"
// Support for Java 8 features
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Project level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
// Safe Args
id 'androidx.navigation.safeargs' version '2.4.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I also added the android.useAndroidX=true and android.enableJetifier=true lines in gradle.properties.
The error:
Duplicate class androidx.navigation.ActivityKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavArgsLazyKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavArgsLazyKt$navArgs$1 found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorDestinationBuilder found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorDestinationBuilderKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorExtrasKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.AnimBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavActionBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgsLazy found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgsLazyKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgumentBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavControllerKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDslBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDslBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDestinationBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDestinationDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels$1 found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels$backStackEntry$2 found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels$storeProducer$1 found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavHostKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavigatorProviderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.PopUpToBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.ViewKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.DialogFragmentNavigatorDestinationBuilder found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.DialogFragmentNavigatorDestinationBuilderKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavArgsLazyKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavArgsLazyKt$navArgs$1 found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorDestinationBuilder found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorDestinationBuilderKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorExtrasKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.ui.ActivityKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration$1 found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration$2 found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration$3 found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$sam$i$androidx_navigation_ui_AppBarConfiguration_OnNavigateUpListener$0 found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.BottomNavigationViewKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.CollapsingToolbarLayoutKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.MenuItemKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.NavControllerKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.NavigationViewKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.ToolbarKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Go to the documentation to learn how to Fix dependency resolution errors.
You can't mix and match navigation-fragment:2.4.2 (from your dependency) and navigation-fragment-ktx:2.3.4 (from Amplify) - all navigation artifacts need to be the same version.
So just change your dependencies to use the -ktx versions of each artifact, thus ensuring that both the version you specifically depend on and the version pulled in from Amplify are the same.
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
While updating my app to the latest library versions, I have encountered the following issue:
Duplicate class com.google.android.gms.internal.measurement.zzfu found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzfv found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzfw found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzfx found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzfy found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzfz found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzq found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzs found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzfh found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzgl found in modules jetified-play-services-measurement-18.0.0-runtime (com.google.android.gms:play-services-measurement:18.0.0) and jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgm found in modules jetified-play-services-measurement-18.0.0-runtime (com.google.android.gms:play-services-measurement:18.0.0) and jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgn found in modules jetified-play-services-measurement-18.0.0-runtime (com.google.android.gms:play-services-measurement:18.0.0) and jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgo found in modules jetified-play-services-measurement-18.0.0-runtime (com.google.android.gms:play-services-measurement:18.0.0) and jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgp found in modules jetified-play-services-measurement-18.0.0-runtime (com.google.android.gms:play-services-measurement:18.0.0) and jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzgq found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzhs found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzhx found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.0-runtime (com.google.android.gms:play-services-measurement-impl:18.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
After checking the dependencies, I was able to fix the build errors using the following in my build.gradle file:
resolutionStrategy {
force("com.google.android.gms:play-services-measurement-base:18.0.0")
force("com.google.android.gms:play-services-measurement-sdk-api:18.0.0")
}
Although the app builds fine and ads are showing, I am worried that overriding the the default dependency versions for google play ads library will cause some issue with impression tracking, etc.
Is there any official solution here? I need analytics and ads. Is there something I'm missing here?
Thanks!
when i add this : implementation 'com.github.barteksc:android-pdf-viewer:2.8.2' in gradle build
then run this and then showing error that is given below: Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
After upgrading all libraries to androidx and to the latest versions of Firebase libraries
I got error with 2 different versions of dagger java files, link in the error message doesn't work. Problem occurs at step :app:checkDebugDuplicateClasses.
I do not use dagger directly in my code, using
./gradlew app:dependencies
I found what com.google.android.gms:play-services-cast-framework:17.1.0 uses com.google.dagger:dagger:2.22, but no info about 1.2.2.
Cause 1: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class dagger.Lazy found in modules dagger-1.2.2.jar (dagger-1.2.2.jar) and dagger-2.22.jar (com.google.dagger:dagger:2.22)
Duplicate class dagger.MembersInjector found in modules dagger-1.2.2.jar (dagger-1.2.2.jar) and dagger-2.22.jar (com.google.dagger:dagger:2.22)
Duplicate class dagger.Module found in modules dagger-1.2.2.jar (dagger-1.2.2.jar) and dagger-2.22.jar (com.google.dagger:dagger:2.22)
Duplicate class dagger.Provides found in modules dagger-1.2.2.jar (dagger-1.2.2.jar) and dagger-2.22.jar (com.google.dagger:dagger:2.22)
Duplicate class javax.inject.Inject found in modules javax.inject-1.jar (javax.inject-1.jar) and javax.inject-1.jar (javax.inject:javax.inject:1)
Duplicate class javax.inject.Named found in modules javax.inject-1.jar (javax.inject-1.jar) and javax.inject-1.jar (javax.inject:javax.inject:1)
Duplicate class javax.inject.Provider found in modules javax.inject-1.jar (javax.inject-1.jar) and javax.inject-1.jar (javax.inject:javax.inject:1)
Duplicate class javax.inject.Qualifier found in modules javax.inject-1.jar (javax.inject-1.jar) and javax.inject-1.jar (javax.inject:javax.inject:1)
Duplicate class javax.inject.Scope found in modules javax.inject-1.jar (javax.inject-1.jar) and javax.inject-1.jar (javax.inject:javax.inject:1)
Duplicate class javax.inject.Singleton found in modules javax.inject-1.jar (javax.inject-1.jar) and javax.inject-1.jar (javax.inject:javax.inject:1)
Go to the documentation to learn how to Fix dependency resolution errors.
The easiest way is to analyze dependencies.
SOLUTION #1 (console only)
Run in console:
./gradlew -q dependencies app:dependencies
After receiving list of dependencies in the console, go to Analyze part (below Solution #2).
SOLUTION #2 (generate html)
1) Add plugin to generate report
In to app/build.gradle (this with compileSdkVersion, targetSdkVersion or buildTypes), at the top add:
apply plugin: 'project-report'
near one of them:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
which are on top.
2) Generate report
Just from the console run:
./gradlew htmlDependencyReport
or from Android Studio
Tasks > other > htmlDependencyReport
3) Open report
In console you will find URL:
./gradlew htmlDependencyReport
> Task :app:htmlDependencyReport
See the report at: file:///Users/user_name/your_path/project_name/app/build/reports/project/dependencies/index.html
And go to the project ':app'
4) Analyze report
After clicking each of the position there are dependencies:
To expand all of them, you can in develper console such code:
$('#dependencies').html(function(index, html) {
return html.split('style="display: none;"')
.join('style="display: block;"')
.split('<h3 class="closed">')
.join('<h3>')
});
ANALYZE
1) Find old dependencies
In your case you are searching phrase dagger:1
Or in the console:
2) Exlude dependencies
Find in the report library name, and just exclude group from this import.
In your build.gradle (where you have all of dependencies) modify "problematic" library excluding dagger v1.
For example:
implementation("some.old.library.using.dagger1:1.0.0") {
exclude group: 'com.squareup.dagger', module: 'dagger'
}