error: cannot find symbol method parseUnknownField(CodedInputStream,ExtensionRegistryLite,int)

I am trying to run simple example with grpc-java in Kotlin. For some reason my generated code from proto file contains error: cannot find symbol method parseUnknownField(CodedInputStream,ExtensionRegistryLite,int).

I have latest versions of com.google.protobuf plugin and the following dependencies installed:

  • grpc-netty
  • grpc-netty-shaded
  • grpc-protobuf
  • protobuf-java
  • protobuf-java-util

My protobuf configuration in build gradle looks like this:

protobuf {
    protoc { artifact = "com.google.protobuf:protoc:${protobufVersion}" } // version 3.25.3
    plugins {
        grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" } // version 1.61.1
    }
    generateProtoTasks {
        all()*.plugins { grpc {} }
    }
}

I have tried changing versions but no luck. Does not understand why the generated code from proto file is broken.

syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";

package helloworld;

// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

Leave a Comment