繁体   English   中英

找不到 com.google.protobuf.MessageOrBuilder 的 class 文件

[英]class file for com.google.protobuf.MessageOrBuilder not found

我正在做我最后一年的项目,一个 android 应用程序,它涉及 firebase 和 dialogflow。 我有这个问题“找不到 com.google.protobuf.MessageOrBuilder 的类文件”。

这是我的应用程序 gradle 代码:

android{
..
..
    configurations.all {
        exclude group:'com.google.api.grpc',module:'proto-google-common-protos'
        exclude group: 'com.google.protobuf'
        //exclude group: 'com.google.guava',module: 'guava-jdk5'
    }
    packagingOptions {
        exclude 'META-INF/INDEX.LIST'
        exclude 'META-INF/DEPENDENCIES'
    }
    lintOptions {
        checkReleaseBuilds false
    }
}

dependencies{
..
..
    //dialogflow
    implementation 'com.google.cloud:google-cloud-dialogflow:2.1.0'
    implementation 'io.grpc:grpc-okhttp:1.30.0'
}

这些是我遇到的错误:

error: cannot access MessageOrBuilder
                .setText(TextInput.newBuilder().setText(message).setLanguageCode("en-US")).build();
                                  ^
  class file for com.google.protobuf.MessageOrBuilder not found

error: cannot access GeneratedMessageV3
        QueryInput input = QueryInput.newBuilder()
                                     ^
  class file for com.google.protobuf.GeneratedMessageV3 not found

error: cannot access Builder
                .setText(TextInput.newBuilder().setText(message).setLanguageCode("en-US")).build();
                                               ^
  class file for com.google.protobuf.GeneratedMessageV3$Builder not found

*更新:dialogflow 依赖项与 firebase 依赖项发生冲突,这会导致我的应用程序连接到其 firebase 时出错。

我希望你能帮助我。 谢谢你。

我刚刚开始使用 gRPC,但我可能遇到了同样的问题,在我的例子中,它通过简单地在 gradle 中添加以下依赖项来工作:

implementation "io.grpc:grpc-protobuf:${grpcVersion}"

简而言之,我的代码没有提供反序列化消息所需的 MessageOrBuilder 所需的依赖项。

我猜作者发现了这个问题(因为 11 个月过去了)。 但是,如果其他人有同样的问题,我建议在 gradle 或 maven 上运行依赖树,并检查(子模块?)是否具有 protobuf-java 依赖项(具有 MessageOrBuilder 类)。 我希望我有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM