Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Sheets API: Getting java.lang.NoSuchMethodError when try running the quickstart example #7332

Open
LouisKwong opened this issue Sep 16, 2020 · 2 comments

Comments

@LouisKwong
Copy link

@LouisKwong LouisKwong commented Sep 16, 2020

Environment details

  1. OS type and version: OSX 10.15.6
  2. Java version: 11.0.8 2020-07-14 LTS
  3. google-cloud-java version(s):
    build.gradle

plugins {
id 'java'
id "com.katalon.gradle-plugin" version "0.0.7"
}

repositories {
mavenCentral()
}

dependencies {
compile 'com.google.api-client:google-api-client:1.30.4'
compile 'com.google.oauth-client:google-oauth-client-jetty:1.30.6'
compile 'com.google.apis:google-api-services-sheets:v4-rev581-1.25.0'
}

Steps to reproduce

  1. When I tried to run the SheetQuickstart.java, I get the following error message
    java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest;
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:434)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:541)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:474)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:591)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$execute.call(Unknown Source)

Any additional information below

The error is reproduced from the following:
ValueRange response = service.spreadsheets().values().get(spreadsheetId, range).execute();

Would you please help on this? Thanks.

@chingor13
Copy link
Collaborator

@chingor13 chingor13 commented Sep 16, 2020

You appear to be using old and incompatible versions of the libraries. setResponseReturnRawInputStream was added in google-http-client 1.29.0, but you are getting an older version of this google-http-client transitively via your old dependency declarations.

The sheets client you are using depends on a very old dependencies. v4-rev2020-0908 is the latest version.

google-api-client 1.30.10 is the latest version of that client.

@LouisKwong
Copy link
Author

@LouisKwong LouisKwong commented Sep 17, 2020

Hi @chingor13 ,

Thanks for the dependencies clarification. However, I am still getting the same error.

build.gradle
plugins {
id 'java'
id "com.katalon.gradle-plugin" version "0.0.7"
}

repositories {
mavenCentral()
}

dependencies {
compile 'com.google.api-client:google-api-client:1.30.10'
compile 'com.google.oauth-client:google-oauth-client-jetty:1.31.0'
compile 'com.google.apis:google-api-services-sheets:v4-rev20200908-1.30.10'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.