Blocked by protobuf error

223 views
Skip to first unread message

Narayan Tendulkar

unread,
Oct 21, 2020, 8:33:18 AM10/21/20
to Protocol Buffers
Hi,

Below is a blocker we are facing related to protobuf which are blocked on, the github thread for the same is as per here. https://github.com/google/protobuf-gradle-plugin/issues/431

I am facing the below error while building my app:

Cause: protoc: stdout: . stderr: google/protobuf/descriptor.proto: File not found.
google/api/annotations.proto:20:1: Import "google/protobuf/descriptor.proto" was not found or had errors.
google/api/annotations.proto:26:8: "google.protobuf.MethodOptions" is not defined.
google/api/annotations.proto:19:1: warning: Import google/api/http.proto but not used.

Can you please point me to the solution to this as I am unable to find any.

Gradle dependencies : App - level gradle :

protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.8.0' } generateProtoTasks { all().each { task -> task.builtins { java { option "lite" } } } } } implementation "io.grpc:grpc-okhttp:1.31.1 implementation "io.grpc:grpc-stub:1.31.1" implementation 'javax.annotation:javax.annotation-api:1.2' implementation 'com.google.protobuf:protobuf-javalite:3.12.0'

Project - level gradle:

classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.13'
Collaborator
ejona86 commented on Sep 2

protobuf-javalite does not support descriptors; it does not have generated code for them nor the .proto. See protocolbuffers/protobuf#7331

Author
meghanashastri commented on Sep 3

Can you please tell me how to fix this ? Since I cannot use protobuf java and javalite which I was using earlier, but after updating all my firebase libraries I have to use only javalite.
Pointing me to fix this would really be helpful.

Thanks.

Collaborator
ejona86 commented on Sep 3

The main workaround I would know is to copy descriptors.proto into your repo and generate code for it. (There's probably a way with gradle to download the protobuf release zip and extract just the one file; but that'd be more plumbing.)

Author
meghanashastri commented on Sep 14

Could you please point me to the protobuf release zip ?

Author
meghanashastri commented on Sep 15

I added the descriptor.proto file in my project.

Got the following error:
Cause: protoc: stdout: . stderr: google/logging/v2/logging.proto:23:1: warning: Import google/rpc/status.proto but not used.
google/logging/v2/logging_config.proto:21:1: warning: Import google/protobuf/timestamp.proto but not used.
google/protobuf/duration.proto: File not found.
google/rpc/error_details.proto:19:1: Import "google/protobuf/duration.proto" was not found or had errors.
google/rpc/error_details.proto:41:3: "google.protobuf.Duration" is not defined.

So I added the duration.proto in my project and got the following error:

Type com.google.protobuf.Duration is defined multiple times: /home/lenovo/.gradle/caches/transforms-2/files-2.1/fab9806a52977a742b01bb17fa23656f/jetified-protobuf-javalite-3.12.0.jar:com/google/protobuf/Duration.class, /home/lenovo/AndroidStudioProjects/NikiLite/app/build/intermediates/javac/debug/classes/com/google/protobuf/Duration.class

Narayan Tendulkar

unread,
Oct 27, 2020, 12:49:38 PM10/27/20
to Protocol Buffers
Hi,

Any update on this please?

We are stuck due to this

de...@perez.earth

unread,
Oct 27, 2020, 5:59:11 PM10/27/20
to Protocol Buffers
Have you had any success using the recommended protobuf-java packages? Seems like you cannot rely on protobuf-lite.

Narayan Tendulkar

unread,
Oct 29, 2020, 2:59:03 AM10/29/20
to Protocol Buffers
Hi,

Yes, we had tried adding particular files which the error specified but was not available in the lite package and it led to other similar errors. 

Plus the latest firebase library we are using requires us to use the protobuf-lite and is not allowing us to use Java.

Anything else which can be done here?

Reply all
Reply to author
Forward
0 new messages