Android 谷歌日历API授权错误

Android 谷歌日历API授权错误,android,google-api,google-calendar-api,Android,Google Api,Google Calendar Api,我是谷歌项目的新手,我必须在我的项目中集成谷歌日历和谷歌任务。为此,我正在重新提交[。我已经添加了: google play服务作为图书馆 google-api-services-calendar-v3-rev81-java-1.18.0-rc 但它显示错误“无法解析类型com.google.api.client.auth.oauth2.draft10.AuthorizationRequestUrl。它是从必需的.class文件间接引用的” 这是我的密码: String clientId

我是谷歌项目的新手,我必须在我的项目中集成谷歌日历和谷歌任务。为此,我正在重新提交[。我已经添加了:

google play服务作为图书馆 google-api-services-calendar-v3-rev81-java-1.18.0-rc

但它显示错误“无法解析类型com.google.api.client.auth.oauth2.draft10.AuthorizationRequestUrl。它是从必需的.class文件间接引用的”

这是我的密码:

    String clientId = "YOUR_CLIENT_ID";
    String clientSecret = "YOUR_CLIENT_SECRET";

    // Or your redirect URL for web based applications.
    String redirectUrl = "urn:ietf:wg:oauth:2.0:oob";
    String scope = "https://www.googleapis.com/auth/calendar";

    // Step 1: Authorize -->
    String authorizationUrl = new GoogleAuthorizationRequestUrl(clientId,
            redirectUrl, scope).build();

    // Point or redirect your user to the authorizationUrl.
    System.out.println("Go to the following link in your browser:");
    System.out.println(authorizationUrl);

    // Read the authorization code from the standard input stream.
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("What is the authorization code?");
    String code = in.readLine();
    // End of Step 1 <--

    // Step 2: Exchange -->
    AccessTokenResponse response = new GoogleAuthorizationCodeGrant(
            httpTransport, jsonFactory, clientId, clientSecret, code,
            redirectUrl).execute();
    // End of Step 2 <--

    GoogleAccessProtectedResource accessProtectedResource = new GoogleAccessProtectedResource(
            response.accessToken, httpTransport, jsonFactory, clientId,
            clientSecret, response.refreshToken);

    com.google.api.services.calendar.Calendar service = new com.google.api.services.calendar.Calendar.Builder(
            httpTransport, accessProtectedResource, jsonFactory).setApplicationName(
            "AppName").build();
String clientId=“您的客户ID”;
String clientSecret=“您的客户秘密”;
//或基于web的应用程序的重定向URL。
String redirectUrl=“urn:ietf:wg:oauth:2.0:oob”;
字符串范围=”https://www.googleapis.com/auth/calendar";
//步骤1:授权-->
String authorizationUrl=新的GoogleAuthorizationRequestUrl(clientId,
重定向URL,作用域);
//将用户指向或重定向到authorizationUrl。
System.out.println(“转到浏览器中的以下链接:”);
System.out.println(授权URL);
//从标准输入流中读取授权代码。
BufferedReader in=新的BufferedReader(新的InputStreamReader(System.in));
System.out.println(“授权码是什么?”);
字符串代码=in.readLine();
//第1步结束
AccessTokenResponse响应=新的GoogleAuthorizationCodeGrant(
httpTransport、jsonFactory、clientId、clientSecret、代码、,
重定向URL);执行();

//步骤2的末尾此错误可能是由于API控制台中的配置错误。请确保将项目设置为“已安装的应用程序”

这也许会有帮助