I’m getting the following runtime error:
Duplicate class com.google.api.Advice found in modules proto-google-common-protos-2.40.0.jar -> proto-google-common-protos-2.40.0 (com.google.api.grpc:proto-google-common-protos:2.40.0) and protolite-well-known-types-18.0.0.aar -> protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0)
I thought that adding the following to my app-level gradle file
implementation(libs.google.api.client) {
exclude group: 'com.google.api.grpc', module: 'proto-google-common-protos' // Exclude the duplicate class
}
would resolve the issue, but it didn’t. Here are the project- and app-level gradle files:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath libs.gradle.v842
classpath libs.google.services
}
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
and
plugins {
id 'com.android.application'
id 'com.google.gms.google-services' // For Firebase integration
}
android {
namespace 'com.uomini.myaiassistantben'
compileSdk 34
defaultConfig {
applicationId "com.uomini.myaiassistantben"
minSdk 26
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}
dependencies {
implementation platform(libs.firebase.bom) // Firebase BOM
implementation libs.com.google.firebase.firebase.firestore // Firestore
// implementation 'com.google.firebase:firebase-auth' // Firebase Auth if needed
implementation libs.google.api.client
implementation libs.google.auth.library.oauth2.http
implementation libs.gax
implementation libs.appcompat
implementation libs.material
implementation(libs.google.api.client) {
exclude group: 'com.google.api.grpc', module: 'proto-google-common-protos' // Exclude the duplicate class
}
// Image processing (if needed)
implementation libs.play.services.mlkit.face.detection
// CameraX for camera interaction
implementation libs.camera.core
implementation libs.camera.camera2
implementation libs.camera.lifecycle
implementation libs.camera.view
implementation libs.camera.extensions
// Cloud vision libraries
implementation libs.google.cloud.vision.v3430
implementation libs.google.cloud.texttospeech.v2460
implementation libs.google.cloud.speech.v230
// Required for one-shot operations (to use `ListenableFuture` from Guava Android)
implementation libs.guava
// Required for streaming operations (to use `Publisher` from Reactive Streams)
implementation libs.reactive.streams
implementation libs.activity
}