I updated firebase admin for my firebase functions and also grpc when I tried to build my app it gave this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.measurement.zzu found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-base-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-base:17.2.2)
Duplicate class com.google.android.gms.internal.measurement.zzv found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-base-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-base:17.2.2)
Duplicate class com.google.android.gms.internal.measurement.zzw found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-base-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-base:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar
(com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurement$ConditionalUserProperty found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Event found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurement$EventInterceptor found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurement$OnEventListener found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Param found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurement$UserProperty found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurementContentProvider found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zza found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzaa found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzab found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzac found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzad found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzae found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzaf found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzag found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzah found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzai found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzaj found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzak found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzal found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzam found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzan found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzao found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzap found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzaq found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzar found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzas found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzb found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzba found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbb found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbc found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbd found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbe found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbf found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbg found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbh found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbi found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbj found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbk found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbl found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbm found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbo found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbp found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbq found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbr found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbs found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbt found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzbu found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzc found in modules jetified-firebase-analytics-impl-16.2.2-runtime.jar (com.google.firebase:firebase-analytics-impl:16.2.2) and play-services-measurement-impl-17.2.2-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.2)
...
This is my android/build.gradle:
buildscript
repositories {
google()
jcenter()
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "27.1.1"
}
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.0.1"
}
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url "https:/maven.google.com"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is android/app/build.gradle:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.tutrconnect"
minSdkVersion 16
targetSdkVersion 28
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.1.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-messaging:20.1.5'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
}
apply plugin: 'com.google.gms.google-services'
pubspec.yaml:
name: tutr_connect
description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
shared_preferences:
cloud_firestore: ^0.9.7+2
image_picker: ^0.6.0+2
firebase_storage: ^2.1.0+1
firebase_auth: ^0.8.3
google_sign_in: ^4.0.1+1
geolocator: 5.0.1
uuid: ^2.0.0
image: ^2.0.7
animator: 0.1.4
cupertino_icons: ^0.1.2
path_provider: ^0.5.0+1
firebase_messaging: ^4.0.0+1
timeago: 2.0.17
cached_network_image: ^2.0.0-rc
flutter_svg: any
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.7.0
flutter_icons:
image_path: 'assets/images/icon.png'
android: true
ios: true
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Raleway
fonts:
- asset: assets/fonts/Raleway/Raleway-Regular.ttf
- asset: assets/fonts/Raleway/Raleway-Italic.ttf
style: italic
- asset: assets/fonts/Raleway/Raleway-Bold.ttf
weight: 700
- asset: assets/fonts/Raleway/Raleway-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Raleway/Raleway-Thin.ttf
weight: 200
- asset: assets/fonts/Raleway/Raleway-ThinItalic.ttf
style: italic
weight: 200
- family: Signatra
fonts:
- asset: assets/fonts/Signatra.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
It says there is a duplicate class but so far, I have tried deleting firebase analytics, play services auth, and firebase core.
implementation 'com.google.firebase:firebase-core:16.0.1'
flutter clean
Invalidate cache / restart
(basing my answer on this github issue)