android - 使用 firebase 和 dialog-flow 解决重复类

标签 android firebase gradle dialogflow-es

我正在开发一个移动应用程序,我需要对话流才能从用户消息中获取一些信息。问题是,当我在应用程序 gradle 中实现对话流时,构建时出现错误,提示我有多个重复类(与 firebase 类冲突)。

我已经尝试过这里建议的方法: https://stackoverflow.com/a/51695425/11023871

甚至在 dialog-flow 的 github 存储库中搜索: https://github.com/googleapis/google-cloud-java/issues/5608#issue-462434090

我试图排除“google-protobuf”,但这没有帮助(我在对话框流组件上遇到编译错误)。

我在下面附上了我的依赖项。

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 指定的一些重复项: 在模块 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)

在模块 classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) 和 proto-google-common-protos-1.16.0 中发现重复类 com.google.api.Advice$1 .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-google-common-protos-1.16 中发现重复类 com.google.api.Advice$Builder。 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-google-common-protos-1.16.0 中发现了重复的类 com.google.api.AdviceOrBuilder。 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-google-common-protos-1.16.0 中发现了重复的类 com.google.api.AnnotationsProto。 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-google-common-protos-1.16.0 中发现了重复的类 com.google.api.AuthProto。 jar (com.google.api.grpc:proto-google-common-protos:1.16.0)

最佳答案

我遇到了同样的问题,经过几个月的调试,感谢 Google 和 Firebase 的更新,我找到了一个有效的解决方案。 我需要更改 Firebase 和对话流程的库版本。 如果您的项目中的最小 SDK 版本小于 19,请将其更改为 19。

Firebase 实现:
Firebase implementation

对话流程实现:
Dialog flow implementation

关于android - 使用 firebase 和 dialog-flow 解决重复类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56922949/

相关文章:

android - 尽管不断调用 onGeoQueryReady,但永远不会触发 Geofire onKeyEntered

javascript - Cloud Functions for Firebase - 创建新用户时写入数据库

swift - 线程 9 : EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, 子代码=0x0) firebase

android - 在哪里可以找到 Android 开发作业问题

Android自定义对话框强制关闭

android - transformClassesWithJarMergingForDebug,com.android.build.api.transform.TransformException : java. util.zip.ZipException:重复条目:

android-studio - Android中的Tensorflow,gradle问题

android - 将Gradle Nature添加到Eclipse上的现有android项目

android - Google 登录 :Error signing in the specified account. 请选择其他帐户

android - 如何改变平面中节点的位置?