Duplicate class with Amplify and Android Navigation - android

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'

Related

Dependency issues using com.google.android.gms:play-services-ads:20.5.0 and com.google.firebase:firebase-analytics:18.0.0

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!

Duplicate class error in android studio, flutter

Following is the error when I try to execute the app, I have tried different methods but nothing working out. Updated flutter, updated the Gradle version to the latest that is 4.1.3 and google service version too that is 4.3.8.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.android.gms.internal.measurement.zzu found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-sdk-api-17.0.0-runtime (com.google.android.gms:play-services-measurement-sdk-api:17.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzv found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-sdk-api-17.0.0-runtime (com.google.android.gms:play-services-measurement-sdk-api:17.0.0)
Duplicate class com.google.android.gms.internal.measurement.zzw found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-base-17.0.0-runtime (com.google.android.gms:play-services-measurement-base:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurement$ConditionalUserProperty found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Event found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurement$EventInterceptor found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurement$OnEventListener found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Param found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurement$UserProperty found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurementContentProvider found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.internal.zza found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzaa found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2) and jetified-play-services-measurement-impl-17.0.0-runtime (com.google.android.gms:play-services-measurement-impl:17.0.0)
Duplicate class com.google.android.gms.measurement.internal.zzab found in modules jetified-firebase-analytics-impl-16.2.2-runtime (com.google.firebase:firebase-analytics-impl:16.2.2
build.gradle:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
}
}
2)app/build.gradle
defaultConfig {
applicationId "appid.com"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'

Task :app:checkDebugDuplicateClasses FAILED java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.firebase_messaging.zza found

The app was working perfectly when I did some changes last time. but suddenly getting the issue of firebase.
implementation project(':react-native-firebase')
implementation 'com.android.support:support-v4:+'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation project(':react-native-device-info')
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
..... other dependencies
implementation 'com.google.firebase:firebase-messaging:16.1.0
getting error
Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzb found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzc found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzd found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zze found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzf found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzh found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzm found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzn found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzo found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzp found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzq found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzr found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
I had same problem here, suddenly android stop work. I'm using react-native 0.61.5.
Here three ways you can solve this issue:
First way: (solved my problem)
On your android/build.gradle add this line to ext section:
firebaseVersion = "21.1.0"
Second way: (also solved my problem)
If the first way not work, maybe you should have to do a little bit more. In your android/buld.gradle:
firebaseMessagingVersion = "21.1.0"
buildToolsVersion = "29.0.2"
firebaseCoreVersion = "17.0.0"
firebaseVersion = "21.1.0"
on your android/app/build.gradle, add this:
implementation 'com.google.firebase:firebase-messaging:21.1.0'
Third way
You will need to find all dependencies of firebase that are brake your application, pay attention for you node_modules dependencies that are using something related to firebase. Once you have all dependencies mapped, you will need to specify versions on your android/build.gradle and android/app/build.gradle.
Notes:
Sorry for my english, i tried.
i was having this issue, i found that firebase-iid worked on the same version than firebase-messaging, but now the messaging version is 22.0.0 and the mayor version of firebase-iid is 21.1.0, so yo have to separate the dependencies with each corresponding version.
Used below firebase-messaging version
implementation 'com.google.firebase:firebase-messaging:21.1.0'
Good Luck!
removing implementation 'com.google.firebase:firebase-analytics on your
android/app/build.gradle

Android: combining the same library's different versions where one is old and one is migrated in a project

For my image processing project on android, I need to use the two libraries:
android_face_detection
EPassportNFCReader
I want to combine these to libraries in a project to make a library and use them in my real project. There is an inconsistency in the dependencies. I've figured out that the following libraries don't work together since one of them is the migrated version of the other.
com.google.firebase:firebase-ml-vision:24.1.0 //used by 1.
com.google.android.gms:play-services-mlkit-text-recognition:16.1.2 //used by 2.
I've figured out that Google migrated the firebase-ml-vision to com.google.android.gms. I tried to migrate the first project but figured out that the migration is not easy for the first library.
Is there a way to use those together?
The duplicate errors I've got if I put the libraries together:
Duplicate class com.google.android.gms.internal.vision.zzbl found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbn found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbo found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbp found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbq found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbr found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbs found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbt found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbx found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkf found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkh found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzki found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkj found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkk found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkl found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkm found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkn found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzko found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkp found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
The suggestion would be NOT to mixed use of these two libraries, since the symbol duplication issues mentioned above.
We provided a migration doc here: https://developers.google.com/ml-kit/migration/android
We are happy to help if there is any migration issue in the process.

Duplicate classes when building app with firebase-firestore and google-cloud-language - android

I'm getting duplicate class errors when I try to build android app that use firebase-firestore and google-cloud-language.
Duplicate class com.google.api.Advice found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.AdviceOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
...
Duplicate class com.google.type.TimeOfDayProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
My build.gradle looks like follow:
...
dependencies {
...
implementation 'com.google.firebase:firebase-ml-vision:20.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
implementation 'io.grpc:grpc-okhttp:1.19.0'
implementation'com.google.cloud:google-cloud-language:1.76.0'
}
How can I solve the issuse ?

Categories

Resources