It basically happening because firebase firestore is using protobuf-javalite and DialogFlow is using protobuf-java library and they have large number of common classes. I tried different solution but not able to solve it.
1. Excluding protobuf-java
configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-java')
If I exclude this library then I'm getting these errors and not able to run the app.
String botReply = returnResponse.getQueryResult().getFulfillmentText();
^
class file for com.google.protobuf.MessageOrBuilder not found
class file for com.google.protobuf.GeneratedMessageV3$Builder not found
2. Excluding protobuf-javalite
configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')
Caused by: java.lang.VerifyError: Verifier rejected class com.google.firestore.v1.WriteResponse due to bad method java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object) (declaration of 'com.google.firestore.v1.WriteResponse' appears in /data/app/com.app.android.name-1/split_lib_dependencies_apk.apk:classes2.dex)
build.gradle (chatFirebase)
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation project(path: ':apputil')
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'com.google.android.play:core:1.10.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
api platform("com.google.cloud:libraries-bom:20.8.0"){}
api ("com.google.cloud:google-cloud-dialogflow"){}
api ("io.grpc:grpc-okhttp:1.31.1"){}
}
build.gradle (apputil)
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.core:core-ktx:1.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
api("com.github.barteksc:android-pdf-viewer:2.8.2") {
exclude group: 'com.android.support', module: 'support-v4'
}
api 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
api 'com.roger.catloadinglibrary:catloadinglibrary:1.0.5'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
api platform("com.google.firebase:firebase-bom:26.0.0"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-core"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-firestore"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-auth"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-auth-ktx"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-database"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-messaging"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-storage-ktx"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-core"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-config"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("com.google.firebase:firebase-dynamic-links"){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
}
api ("io.reactivex.rxjava2:rxjava:2.2.7"){
exclude group: 'com.android.support', module: 'support-v4'
}
api ("io.reactivex.rxjava2:rxandroid:2.0.2"){
exclude group: 'com.android.support', module: 'support-v4'
}
implementation ("com.squareup.retrofit2:retrofit:2.6.1"){
exclude group: 'com.android.support', module: 'support-v4'
}
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
api 'com.cocosw:bottomsheet:1.5.0'
}
build.gradle(app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/*.kotlin_module")
exclude 'META-INF/INDEX.LIST'
exclude 'google/protobuf/field_mask.proto'
exclude 'protobuf.meta'
exclude("google/protobuf/type.proto")
exclude("google/protobuf/wrappers.proto")
exclude("google/protobuf/timestamp.proto")
exclude("google/protobuf/duration.proto")
exclude("google/protobuf/api.proto")
exclude("google/protobuf/any.proto")
exclude("google/protobuf/source_context.proto")
exclude("google/protobuf/descriptor.proto")
exclude("google/protobuf/empty.proto")
exclude("google/protobuf/struct.proto")
exclude("google/protobuf/field_mask.proto")
// exclude("com/google/protobuf/AbstractMessageLite")
//exclude ("google/protobuf/AbstractMessageLite.class")
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
resConfigs "en", "US"
applicationId "com.app.fixmantra"
minSdkVersion 19
targetSdkVersion 30
versionCode 4
versionName "1.0.0.1"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "GOOGLE_MAP_KEY", GOOGLE_MAP_KEY)
resValue("string", "GOOGLE_MAP_KEY", GOOGLE_MAP_KEY)
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
debuggable false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
rootProject.flavour = 0
flavorDimensions "default"
}
}
dependencies {
def exoplayer = "2.10.5"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.kenilt.loopingviewpager:loopingviewpager:0.2.0'
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation project(path: ':apputil')
implementation project(path: ':agoravideo')
implementation project(path: ':chatfirebase')
implementation 'com.algolia:algoliasearch-android:3.27.0'
implementation 'com.vorlonsoft:androidrate:1.2.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.code.gson:gson:2.8.7'
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.google.android.play:core:1.10.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.shobhitpuri.custombuttons:google-signin:1.1.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'co.lujun:androidtagview:1.1.7'
implementation 'io.kommunicate.sdk:kommunicateui:2.1.4'
// GMS
implementation 'com.google.android.libraries.places:places:2.4.0'
implementation 'com.google.maps.android:android-maps-utils:0.4.4'
implementation("com.google.android.exoplayer:exoplayer:${exoplayer}") {
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation("com.google.android.exoplayer:exoplayer-ui:${exoplayer}") {
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation 'com.ramotion.paperonboarding:paper-onboarding:1.1.1'
implementation 'net.colindodd:gradientlayout:1.2'
}
//configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types')
//configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')
//configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-java')
Here is the error I'm getting if I don't Exclude Module.
Duplicate class com.google.protobuf.AbstractMessageLite found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AbstractMessageLite$InternalOneOfEnum found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AbstractParser found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AbstractProtobufList found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AllocatedBuffer found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AllocatedBuffer$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AllocatedBuffer$2 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.Android found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.Any found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.Any$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.Any$Builder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AnyOrBuilder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.AnyProto found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.Api found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.Api$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.Api$Builder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ApiOrBuilder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ApiProto found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ArrayDecoders found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ArrayDecoders$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ArrayDecoders$Registers found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryReader found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryReader$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryReader$SafeHeapReader found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryWriter found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryWriter$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryWriter$SafeDirectWriter found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryWriter$SafeHeapWriter found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryWriter$UnsafeDirectWriter found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BinaryWriter$UnsafeHeapWriter found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BoolValue found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BoolValue$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BoolValue$Builder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BoolValueOrBuilder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BooleanArrayList found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BufferAllocator found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BufferAllocator$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteBufferWriter found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteOutput found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$2 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$AbstractByteIterator found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$ArraysByteArrayCopier found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$BoundedByteString found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$ByteArrayCopier found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$ByteIterator found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$CodedBuilder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$LeafByteString found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$LiteralByteString found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$Output found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.ByteString$SystemByteArrayCopier found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BytesValue found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BytesValue$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BytesValue$Builder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.BytesValueOrBuilder found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.CodedInputStream found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Duplicate class com.google.protobuf.CodedInputStream$1 found in modules jetified-protobuf-java-3.17.3 (com.google.protobuf:protobuf-java:3.17.3) and jetified-protobuf-javalite-3.17.2 (com.google.protobuf:protobuf-javalite:3.17.2)
Yes, the long term solution is to convince the plugin author lagging behind to move forward to use the proper dependency. But until such time, you might need to fix the problem, anyway. Locate the dependency that causes the problems, uses the bad version of the conflicting plugins, or the one that you want drop. In my particular case, it was Huawei's com.huawei.agconnect. Then in your app/build.gradle, locate the dependency implementation, and instead of just calling it:
implementation "com.huawei.agconnect:agcp:1.6.5.300"
turn it into the full format with an exclude entry:
implementation("com.huawei.agconnect:agcp:1.6.5.300") {
exclude group: "com.google.protobuf", module: "protobuf-java"
}
This applies to any similar scenario, you can decide what to exclude and hope that the remaining one will do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With