I am trying to install grpc for Android with access to Timestamp. The generated code generates ok but the project throws this error. I did some research and it looks like it has to do with guava. Attached is my app build.grade:
Error
> Task :app:compileDevDebugJavaWithJavac
error: cannot access CheckReturnValue
class file for javax.annotation.CheckReturnValue not found
cannot access CheckReturnValue
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
Build Gradle Snippet
``
// You need to build grpc-java to obtain these libraries below.
implementation 'io.grpc:grpc-okhttp:1.55.1' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.55.1' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.55.1' // CURRENT_GRPC_VERSION
implementation 'org.apache.tomcat:annotations-api:6.0.53'
implementation 'com.google.protobuf:protobuf-javalite:3.23.2'
implementation("com.google.protobuf:protobuf-java:3.23.0") {
exclude(group: 'com.google.guava', module: 'guava')
exclude(group: 'org.checkerframework', module: 'checker-compat-qual')
exclude(group: 'javax.annotation', module: 'jsr250-api')
exclude(group: 'io.opencensus', module: 'opencensus-api')
exclude(group: 'com.google.errorprone', module: 'error_prone_annotations')
exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')
exclude(group: 'io.grpc', module: 'grpc-context')
}
// implementation 'com.google.errorprone:error_prone_annotations:2.18.0'
// implementation("com.google.guava:guava:32.0.1-android")
//protobuf 'com.google.protobuf:protobuf-java:3.23.0'
}
protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.23.2' }
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.55.1' // CURRENT_GRPC_VERSION
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
java { option 'lite' }
}
task.plugins {
grpc { // Options added to --grpc_out
option 'lite'
}
}
}
}
}
```
Thanks in advance! Lmk if you want any more info