Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/129.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 如何使用GAE初始化驱动器服务_Google App Engine_Oauth 2.0_Google Api_Google Drive Api_Google Api Client - Fatal编程技术网

Google app engine 如何使用GAE初始化驱动器服务

Google app engine 如何使用GAE初始化驱动器服务,google-app-engine,oauth-2.0,google-api,google-drive-api,google-api-client,Google App Engine,Oauth 2.0,Google Api,Google Drive Api,Google Api Client,我需要在GAE应用程序中初始化驱动器服务。我正在使用OAuth2.0和三条腿的。我使用普通谷歌账户(没有服务账户)。我正在努力: GoogleCredential credentials = usuarioService.getGoogleCredentials(); Drive service = new Drive.Builder(TRANSPORT, JSON_FACTORY, credentials).build(); 我得到了这个错误: Caused by: java.lang.No

我需要在GAE应用程序中初始化驱动器服务。我正在使用OAuth2.0和三条腿的。我使用普通谷歌账户(没有服务账户)。我正在努力:

GoogleCredential credentials = usuarioService.getGoogleCredentials();
Drive service = new Drive.Builder(TRANSPORT, JSON_FACTORY, credentials).build();
我得到了这个错误:

Caused by: java.lang.NoSuchFieldError: MAJOR_VERSION
at com.google.api.services.drive.Drive.<clinit>(Drive.java:48)
at com.google.api.services.drive.Drive$Builder.build(Drive.java:8243)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.google.api.services.drive.Drive
你能帮我吗

迭戈

更新 我已经将驱动器库更新为(v2)和谷歌api客户端1.18,但它仍然不工作

现在我得到了这个错误:

Caused by: java.lang.NoSuchFieldError: MAJOR_VERSION
at com.google.api.services.drive.Drive.<clinit>(Drive.java:48)
at com.google.api.services.drive.Drive$Builder.build(Drive.java:8243)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.google.api.services.drive.Drive
更新2 考虑到我在重建GoogleCredential对象时出错,当我从授权流请求原始凭据时,我尝试调用Drive.Builder()

final GoogleTokenResponse response = flow.newTokenRequest(authCode).setRedirectUri(callback).execute();     
Credential credential = flow.createAndStoreCredential(response, null);
// Calling to Drive Service
Drive service = new Drive.Builder(httpTransport, jsonFactory, credential).build();
我得到了同样的错误:

Caused by: java.lang.NoSuchFieldError: MAJOR_VERSION
我对日历做了同样的操作,得到了相同的错误

我正在使用下一个库: 谷歌api客户端1.18

谷歌api客户端servlet 1.18

google-api-service-drive-v2-1.18

谷歌http客户端1.18

谷歌http客户端jackson 1.18


谷歌oauth客户端1.18解决方案:

喝了很多杯咖啡后,我发现了错误


我已经清理了我的项目中的一些库,我正在使用1.15版本的Google库,它正在工作(代码相同)。

你在GAE中打开了驱动器API了吗?它已打开@jedison,顺便说一下,我正在使用Eclipse进行本地工作。您已经为该项目启用了驱动器SDK:“驱动器SDK在此项目上未处于活动状态”。>对我的应用程序中有不同的用户。组和个人用户。我将服务帐户和OAuth 1.0用于组,它正在工作。我无法对单个用户使用SA,我使用的是OAuth 2.0,无法工作。您是否与drEdit示例进行了比较?