I was working on my final year project, an android app which involves both firebase and dialogflow. I have this problem of "class file for com.google.protobuf.MessageOrBuilder not found".
This is my app gradle code:
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'
}
These are the errors that I faced:
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
*Update: The dialogflow dependencies clashes with firebase dependencies, which causes an error for my app to connect to its firebase.
I hope u can help me. Thank you.
I am just starting to work with gRPC, but i may have had the same issue and in my case it worked by simply adding in gradle the below dependency:
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Simply put, my code did not have the required dependency that provided MessageOrBuilder, which is needed to deserialize the message.
I guess author found the issue (since 11 months passed). However if someone else has the same issue I propose to run a dependency tree on gradle or maven and check if the (sub-module?) has the protobuf-java dependency (which has the MessageOrBuilder class). I hope i helped.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.