使用Firebase和对话框流解决重复的类 [英] Resolve duplicate classes with firebase and dialog-flow
问题描述
我正在开发一个移动应用程序,在这里我需要对话流以便从用户消息中获取一些信息。问题是,当我在应用gradle中实现对话框流时,在构建时出现错误,说我有多个重复的类(与firebase类冲突)。
I am working on a mobile app where I need dialog-flow in order to get some information from a user message. The problem is, when I implement dialog-flow into the app gradle, I get an error on build, saying that I have multiple duplicate classes ( conflicting with firebase classes).
我已经尝试过此处建议的方法:
https://stackoverflow.com/a/51695425/11023871
I've tried methods suggested here: https://stackoverflow.com/a/51695425/11023871
甚至在对话框流的github存储库中进行搜索:
https://github.com/googleapis/google-cloud-java/issues/5608#issue-462434090
and even searched on the github repository of dialog-flow: https://github.com/googleapis/google-cloud-java/issues/5608#issue-462434090
我试图排除'google-protobuf',但这没有帮助(我在对话框流组件上出现编译错误)。
I tried to exclude 'google-protobuf', but that didn't help (I got compilation error on dialog-flow components).
我在下面附加了我的依赖项。
I attached my dependencies below.
dependencies {
implementation 'com.hbb20:ccp:2.2.4'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.2'
implementation 'com.google.cloud:google-cloud-dialogflow:0.99.0-alpha'
}
编辑
这些是gradle指定的重复项:
重复类com.google.api .Advice在模块classes.jar(com.google.firebase:protolite-well-known-types:16.0.1)和proto-google-common-protos-1.16.0.jar(com.google.api.grpc: proto-google-common-protos:1.16.0)
EDIT These are some of the duplicates specified by gradle: Duplicate class com.google.api.Advice found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
在模块classes.jar中找到重复的com.google.api.Advice $ 1类(com.google.firebase: protolite-known-types:16.0.1)和proto-google-common-protos-1.16.0.jar(com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.Advice$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
在模块classes.jar(com.google.firebase:protolite-well-known-types:16.0.1)和proto中找到重复的类com.google.api.Advice $ Builder -google-common-protos-1.16.0.jar(com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.Advice$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
重复的类com.google.api.AdviceOrBuilder在模块classes.jar(com.google.firebase:protolite-well-known-types:16.0.1)和proto-google-common-protos-1.1中找到6.0.jar(com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AdviceOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
重复的类com.google.api.AnnotationsProto位于模块classes.jar(com.google.firebase:protolite-well-known-types:16.0.1)和proto-google-common-protos-1.16.0.jar(com.google.api.grpc:proto-google- common-protos:1.16.0)
Duplicate class com.google.api.AnnotationsProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
在模块classes.jar中发现重复的类com.google.api.AuthProto(com.google.firebase:protolite-众所周知-types:16.0.1)和proto-google-common-protos-1.16.0.jar(com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
推荐答案
我有重复的类,它是jar,但我从未从gradle中排除某些东西。你能帮我吗?例如,我有以下内容:在模块classes.jar(com.google.firebase:protolite-well-known-types:16.0.1)和proto-google-common-protos中找到重复的com.google.api.Advice类-1.16.0.jar(com.google.api.grpc:proto-google-common-protos:1.16.0)
I have the duplicate classes and it's jars, but I never excluded something from gradle. Could you please help me out? For example, I have this: "Duplicate class com.google.api.Advice found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)"
我不确定为什么这些罐子重复相同的类或您要保留哪个类。但是您可以执行以下操作
I'm not sure why these jars are duplicating the same classes or which one you want to keep. But you can do something like
dependencies {
implementation 'com.hbb20:ccp:2.2.4'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
...
}
configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types')
这篇关于使用Firebase和对话框流解决重复的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!