ユーザーのプロファイル データを認証して取得しようとしていますが、エラーを下回っています。提案してください。
// Generate the URL to which we will direct users
String authorizeUrl = new GoogleAuthorizationRequestUrl(CLIENT_ID,
CALLBACK_URL, SCOPE).build();
System.out.println("Paste this url in your browser: " + authorizeUrl);
// Wait for the authorization code
System.out.println("Type the code you received here: ");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String authorizationCode = in.readLine();
// Exchange for an access and refresh token
GoogleAuthorizationCodeGrant authRequest = new GoogleAuthorizationCodeGrant(
TRANSPORT, JSON_FACTORY, CLIENT_ID, CLIENT_SECRET,
authorizationCode, CALLBACK_URL);
authRequest.useBasicAuthorization = false;
AccessTokenResponse authResponse = authRequest.execute();
String accessToken = authResponse.accessToken;
GoogleAccessProtectedResource requestInitializer = new GoogleAccessProtectedResource(
accessToken, TRANSPORT, JSON_FACTORY, CLIENT_ID, CLIENT_SECRET,
authResponse.refreshToken);
// Set up the main Google+ class
Plus plus = new Plus(TRANSPORT, requestInitializer,JSON_FACTORY);
// Make a request to access your profile and display it to console
Person profile = plus.people.get("me").execute();
System.out.println("ID: " + profile.getId());
System.out.println("Name: " + profile.getDisplayName());
System.out.println("Image URL: " + profile.getImage().getUrl());
System.out.println("Profile URL: " + profile.getUrl());
エラーは:-
スレッド「メイン」の例外 java.lang.IllegalAccessError: com.google.api.client でクラス com.google.api.client.googleapis.MethodOverride からフィールド com.google.api.client.http.HttpRequest.method にアクセスしようとしました.googleapis.MethodOverride.overrideThisMethod(MethodOverride.java:99) com.google.api.client.googleapis.MethodOverride.intercept(MethodOverride.java:87) com.google.api.services.plus.ApiClient.buildHttpRequest(ApiClient) .java:251) com.google.api.services.plus.Plus$RemoteRequest.execute(Plus.java:1055) com.google.api.services.plus.Plus$People$Get.executeUnparsed(Plus.java) :991) com.googleplus.test.TestAuth2.main(TestAuth2.java:64) で com.google.api.services.plus.Plus$People$Get.execute(Plus.java:976) で