'Trying to get access token with the help of refresh token gives java.lang.IncompatibleClassChangeError

So I am trying to get access token with the help of a refresh token with the method below,

public String refreshAccessToken() throws IOException {
        String refresh_token = "****";
        String client_id = "****";
        String client_secret = "****";
        GoogleTokenResponse response = new GoogleRefreshTokenRequest(
                new NetHttpTransport(),
                new JacksonFactory(),
                refresh_token, 
                client_id,
                client_secret)
                .execute();
        System.out.println("Access Token:"+response.getAccessToken().toString());
        return response.getAccessToken().toString();
    }

Calling following method returns below exception java.lang.IncompatibleClassChangeError: class com.google.api.client.auth.oauth2.TokenResponseException cannot inherit from final class com.google.api.client.http.HttpResponseException

Is there any way to resolve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source