‘NoSuchMethodError’ is a generic non-Google Java runtime error caused by a maven dependency conflict. This is specifically a Java dependency conflict concerning the ‘io.grpc’ library as noted in the error.
As explained in the Maven documentation, you can use the following command to see what version of “io.grpc” dependency is installed in your local environment that is causing the issue:
mvn dependency:tree -Dverbose -Dincludes=io.grpc
Once you have identified the conflicting Java dependency after running the previous command, you can then try to resolve the conflict by performing these generic steps:
- Try a clean install of maven:
mvn clean install
and execute the file.
- You can update all versions to the latest release:
mvn versions:use-latest-releases
and execute the file.
- Follow the additional recommendations noted in this similar Stack Overflow post which addresses the “NoSuchMethodError” issue.
As a workaround, I tested the Quickstart code in Google Cloud
Shell and it runs flawlessly (as Cloud Shell has pre-installed
packages which are up to-date and reset upon closing). So for
testing purposes you can run the code in the Cloud Shell instead
of in your local environment.