首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >重复类错误-java&与DialogFlow和Firebase

重复类错误-java&与DialogFlow和Firebase
EN

Stack Overflow用户
提问于 2021-07-25 11:38:51
回答 1查看 949关注 0票数 3

基本上是因为firestore使用的是protobuf,而DialogFlow使用的是protobuf库,它们有大量的公共类。我尝试了不同的解决方案,但没能解决。

1.不包括protobuf java

configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-java')

如果我排除了这个库,那么我将得到这些错误,并且无法运行该应用程序。

代码语言:javascript
复制
  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.不包括protobuf javalite

configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')

代码语言:javascript
复制
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)

代码语言:javascript
复制
 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)

代码语言:javascript
复制
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)

代码语言:javascript
复制
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')

这是如果不排除模块的话,我会遇到的错误。

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

发布于 2022-05-28 16:04:05

是的,长期的解决方案是说服落后的插件作者继续使用适当的依赖。但在此之前,无论如何,你可能需要解决这个问题。找到导致问题的依赖项,使用冲突插件的坏版本,或者要删除的插件。就我个人而言,这是华为的com.huawei.agconnect。然后,在app/build.gradle中定位依赖实现,而不是仅仅调用它:

代码语言:javascript
复制
implementation "com.huawei.agconnect:agcp:1.6.5.300"

使用exclude条目将其转换为完整的格式:

代码语言:javascript
复制
implementation("com.huawei.agconnect:agcp:1.6.5.300") {
  exclude group: "com.google.protobuf", module: "protobuf-java"
}

这适用于任何类似的场景,您可以决定排除什么,并希望剩余的场景能够完成此任务。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68518177

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档