When I tried to run the gRPC sample code on Java 11, the code generation worked, but it stopped with the following error at runtime.
error:Can't find symbol
@javax.annotation.Generated(
^
symbol:Class Generated
place:Package javax.annotation
Issue Java 11: cannot find symbol javax.annotation.Generated # 5343 of grpc / grpc-java Add the Javax Annotation API to dependencies
as described in grpc-java / issues / 5343). (It is reported that this issue itself does not work if you insert a conditional branch of Java9, but it will work if you do not insert a conditional branch like ↓.)
build.gradle (excerpt)
dependencies {
implementation 'io.grpc:grpc-netty-shaded:1.23.0'
implementation 'io.grpc:grpc-protobuf:1.23.0'
implementation 'io.grpc:grpc-stub:1.23.0'
compile 'javax.annotation:javax.annotation-api:1.3.2' //← Add this line
testCompile group: 'junit', name: 'junit', version: '4.12'
}
Check the Maven Repository for the latest version of the Javax Annotation API. https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api
Recommended Posts