Reputation: 33
I created a gRPC project very similar to the example gRPC for kotlin android project at https://github.com/grpc/grpc-java/tree/master/examples/example-kotlin/android/helloworld
The building process works if i use the example proto files. But now, that I have replaced the protofiles with different ones, Gradle fails to build my project.
This is the failing proto file:
syntax = "proto3";
package tensorflow.serving;
option cc_enable_arenas = true;
import "google/protobuf/wrappers.proto";
// Metadata for an inference request such as the model name and version.
message ModelSpec {
// Required servable name.
string name = 1;
// Optional version.
google.protobuf.Int64Value version = 2;
// A named signature to evaluate. If unspecified, the default signature will
// be used.
string signature_name = 3;
}
The error message is:
Cause: protoc: stdout: . stderr: app/build/extracted-include-protos/main: warning: directory does not exist.
app/build/extracted-include-protos/main: warning: directory does not exist.
app/src/debug/proto: warning: directory does not exist.
app/src/debug/proto: warning: directory does not exist.
google/protobuf/wrappers.proto: File not found.
model.proto: Import "google/protobuf/wrappers.proto" was not found or had errors.
model.proto:30:3: "google.protobuf.Int64Value" is not defined.
Upvotes: 1
Views: 3922
Reputation: 629
The "well-known" protos that are shipped with the normal protobuf jar are not included in the protobuf-lite jar, which the kotlin Android example is using. The issue is tracked in https://github.com/protocolbuffers/protobuf/issues/1889
As a workaround, you can add the protos from the normal protobuf jar to your project:
dependencies {
protobuf 'com.google.protobuf:protobuf-java:3.5.1'
}
Upvotes: 1