Method getAuthenticateAsList not found Crash – Signup/Signin with Google+ API integration : Java Spring dependency

Method getAuthenticateAsList not found Crash – Signup/Signin with Google+ API integration : Java Spring dependency

Crash Report :

SEVERE [http-nio-8080-exec-4] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Spring] in context with path [/testapp] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: com.google.api.client.http.HttpHeaders.getAuthenticateAsList()Ljava/util/List;] with root cause
java.lang.NoSuchMethodError: com.google.api.client.http.HttpHeaders.getAuthenticateAsList()Ljava/util/List;
at com.google.api.client.auth.oauth2.Credential.handleResponse(Credential.java:245)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:992)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at com.testapp.service.impl.UserServiceImpl.postSignUp(UserServiceImpl.java:147)
at com.testapp.controller.UserController.postSignUp(UserController.java:69)
at com.testapp.controller.UserController$$FastClassBySpringCGLIB$$6d302bfc.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at com.testapp.controller.UserController$$EnhancerBySpringCGLIB$$99bf7de6.postSignUp(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)

Solution:

Use latest library version > 1.17

 

                dependency&gt;
			groupId&gt;com.google.apisgoogle-api-services-plusv1-rev282-1.20.0
			groupId&gt;com.google.http-clientgoogle-http-client1.20.0

                 dependency&gt;
			groupId&gt;com.google.http-clientgoogle-http-client1.20.0
                        artifactId&gt;google-http-client1.20.0
                        version&gt;1.20.0

Google plus signup/signin : java code

			TokenResponse tokenResponse = new TokenResponse();
			tokenResponse.setAccessToken(authenticationRequest.getAccessToken());
			GoogleCredential cred = new GoogleCredential().setFromTokenResponse(tokenResponse);

			/*
			 * Default HTTP transport to use to make HTTP requests.
			 */
			HttpTransport TRANSPORT = new NetHttpTransport();
			JacksonFactory JSON_FACTORY = new JacksonFactory();
			Plus plus = new Plus.Builder(TRANSPORT, JSON_FACTORY, cred).setApplicationName(Constants.APPLICATION_NAME)
					.build();
			if (plus != null) {
				try {
					Person userProfile = plus.people().get("me").execute();
					if (userProfile != null) {

					}
				} catch (IOException e) {
					e.printStackTrace();
					return null;
				}
			}