重复类对话框流

lf3rwulv  于 2021-07-11  发布在  Java
关注(0)|答案(0)|浏览(456)

我试图在现有项目中实现dialogflow chatbot功能,但是在包含依赖项之后,我得到了重复的类错误

//dialogFlow
    implementation 'com.google.cloud:google-cloud-dialogflow:2.4.0'
    implementation 'io.grpc:grpc-okhttp:1.32.2'

如果我删除这两个依赖项,一切都正常。搜索之后,我通过这个androidstudio理解了这个错误的原因:解析重复类,我也尝试了这个问题用firebase和dialog flow解析重复类,但它没有解决我的问题
但在我的例子中,我有超过200行的错误,如下所示

Duplicate class com.google.api.Advice found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.Advice$1 found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.Advice$Builder found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.AdviceOrBuilder found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.AnnotationsProto found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.AuthProto found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.AuthProvider found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.AuthProvider$1 found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)
Duplicate class com.google.api.AuthProvider$Builder found in modules jetified-proto-google-common-protos-2.0.0.jar (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-17.1.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.1.0)

我的gradle.build(app)文件

apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.saadBinZahoorOfficial.slipslop"
        minSdkVersion 19
        targetSdkVersion 29

        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    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/project.properties'

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.firebase:firebase-auth:20.0.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'com.github.ybq:Android-SpinKit:1.4.0'
    // add the Firebase SDK for Google Analytics
    implementation 'com.google.firebase:firebase-analytics:18.0.0'

    implementation 'com.google.firebase:firebase-firestore:22.0.0'
    implementation 'com.google.firebase:firebase-messaging:21.0.0'
    // add SDKs for any other desired Firebase products
    // https://firebase.google.com/docs/android/setup#available-libraries

    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.libraries.places:places:2.4.0'
    implementation 'com.google.android.gms:play-services-location:17.1.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5'

    implementation 'com.shawnlin:number-picker:2.4.8'
    implementation 'com.github.arcadefire:nice-spinner:1.4.3'
    implementation 'com.github.kmenager:material-animated-switch:1.2.2'

    implementation group: 'com.backendless', name: 'backendless', version:'6.0.1'

    implementation 'com.github.ome450901:SimpleRatingBar:1.5.0'

    // required for real-time database and real-time messaging
    implementation('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }

    implementation 'com.mikhaellopez:circularprogressbar:3.0.3'

    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    implementation 'com.sasank.roundedhorizontalprogress:roundedhorizontalprogress:1.0.1'

    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation "androidx.viewpager2:viewpager2:1.0.0"
    implementation 'com.jakewharton:butterknife:10.2.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
    implementation 'com.google.firebase:firebase-storage:19.2.0'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
 //  implementation 'com.github.AgnaldoNP:AGSkeletonLoading:1.0'
    implementation 'com.sinch:sdk-sms:1.0.3'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation project(':pocketsphinx-android-5prealpha-release')
    implementation 'androidx.biometric:biometric:1.0.1'
    implementation 'com.google.firebase:firebase-database:19.5.1'
     implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    implementation 'com.mindorks.android:prdownloader:0.6.0'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'joda-time:joda-time:2.10.8'
    implementation("com.squareup.okhttp3:okhttp:4.9.0")

    //dialogFlow
    implementation 'com.google.cloud:google-cloud-dialogflow:2.4.0'
    implementation 'io.grpc:grpc-okhttp:1.32.2'
}
// Add to the bottom of the file

/*repositories {
    mavenCentral()
}*/
apply plugin: 'com.google.gms.google-services'

我做了什么
我将这两行代码添加到gradle.build(app)中

configurations.implementation.exclude(group: 'com.google.api.grpc', module: 'proto-google-common-protos')
configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-java')

问题的重复类修复,但当我运行我的应用程序,它是给我一个错误相关的数据流

class file for com.google.protobuf.MessageOrBuilder not found
class file for com.google.protobuf.GeneratedMessageV3 not found
class file for com.google.protobuf.GeneratedMessageV3$Builder not found

以前我面临编译时错误,因为重复文件的后排除模块,现在我再次面临编译时错误,因为类没有找到
我很感激如果有人帮助我,加上,只是为了确认如果依赖工作正常,我创建了一个新的项目,并添加了相关的dialogflow依赖编译后的应用程序工作正常!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题