Google Drive Java API

穿精又带淫゛_ 提交于 2020-01-05 04:14:10

问题


I am desperately trying to compile

Quickstart: Run a Drive App in Java

but no matter what, I always hit on:

java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient

The same thing happens both for at the servlet and the SE version.

Any ideas?


回答1:


The code compiled and ran fine here.

Steps:

  • Create/select a project at Google Developer Console , enable the Drive API, create a new Client ID so that you have a valid CLIENT_ID,CLIENT_SECRET,REDIRECT_URI.

  • Download google-api-services-drive-v2-rev123-java-1.18.0-rc.zip, extract it and put the following jars in your classpath.

  • Create a text file document.txt and put it in the same package(assuming you are using eclipse as IDE) as your source code.

  • Provide the generated CLIENT_ID,CLIENT_SECRET,REDIRECT_URI(Step 1) in your source code.

  • Compile and run the code.

Output:

Copy the code provided in the browser, paste it in console.

The document will be uploaded to your Google Drive.




回答2:


Well, I had to use the suitable Drive API from Drive API Client Library for Java



来源:https://stackoverflow.com/questions/23613317/google-drive-java-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!