'The type com.google.protobuf.GeneratedMessageV3$Builder cannot be resolved. It is indirectly referenced from required .class files

I have been doing my project and all the sudden eclipse started to give this error saying

The type com.google.protobuf.GeneratedMessageV3$Builder cannot be resolved. 

It is indirectly referenced from required .class files where we declare the package. I have tried adding com.google.protobuf-2.4.0.jar to build path but it did not work. Please help and here's the screenshot.

enter image description here



Solution 1:[1]

com.mysql.cj.x.protobuf.MysqlxSql.StmtExecute is not on the classpath so remove this import

Solution 2:[2]

Not sure if this helps at such a later date. But i also faced something similar.

I found that I imported this by mistake

import com.mysql.cj.x.protobuf.MysqlxDatatypes.Array;

After removing this line, it works fine.

In your case you need to remove the import

com.mysql.cj.x.protobuf.MysqlxSql.StmtExecute

Replace it with the relevant import.

Solution 3:[3]

If you are expecting Protobuf generated files to be available, then ensure that you have added the Protobuf library to your project.

Gradle example:

implementation group: 'com.google.protobuf', name: 'protobuf-java', version: googleProtobufVersion

Maven example:

<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java</artifactId>
    <version>${googleProtobufVersion}</version>
</dependency>

Solution 4:[4]

This is due to the missing dependency of gRPC protobuf. Add this dependency to your pom.xml and this should solve your problem.

    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-protobuf</artifactId>
        <version>1.16.1</version>
    </dependency>

Lastly, do maven -> project update

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Suraj Rao
Solution 2 Anamik Adhikary
Solution 3 bdetweiler
Solution 4