After compiling the proto file, I get "com.google cannot be resolved to a type" error in the created java classes

58 views Asked by At

I'm working on a Maven project in Visual Studio Code.

I'm using this command to compile the proto file:

protoc --plugin=protoc-gen-grpc-java=/home/ayaz/Downloads/protoc-gen-grpc-java-1.56.0-linux-x86_64.exe --grpc-java_out=DataLink_Parser/backend/src/main/java/com/backend --java_out=DataLink_Parser/backend/src/main/java/com/backend DataLink_Parser/backend/src/main/java/com/backend/HelloService.proto

When I compiled the proto file on the computer where my backend codes were written, and the necessary classes for java were created without any problems, but I encountered a lot of errors in java classes that occurred when I compiled the same proto file on the computer where my frontend codes were written.

I get this error in the created java classes:

com.google cannot be resolved to a type

I thought it was from the pom file, but no matter how much I checked the pom file, I couldn't figure it out. I think it may have originated somewhere else.

1

There are 1 answers

0
Hüsnü Ayaz On

I changed the protoc version to 3.12.4 and my problem has been fixed.