3
votes

I am trying to make an app using GRPC protocols. In my .proto file I need to import timestamp class and as per google documentation, import google/protobuf/timestamp.proto is how we should add to proto file. But its giving me error

import google/protobuf/timestamp.proto is not found or has errors

Anyone have any idea how to resolve this.

1

1 Answers

3
votes

You are hitting a known issue; neither the well-known protos nor their generated code are included in protobuf-lite.

A workaround is to add an extra dependency and generate the code yourself. Assuming you are using Gradle and already using the com.google.protobuf plugin, you just need to add a protobuf dependency for the .proto files (or a JAR including the .proto files) you have a dependency on:

dependencies {
  protobuf 'com.google.protobuf:protobuf-java:3.0.2'
}