Cannot resolve method 'setBasicAuth' in 'HttpHeaders'

Viewed 147

My code cannot resolve method 'setBasicAuth' in 'HttpHeaders'. I am trying to copy my java code to android studio, but facing this issue. Am I missing some imports?

import org.springframework.http.*;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;


HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));    // works
headers.setContentType(MediaType.APPLICATION_JSON);                          // works
headers.setBasicAuth(this.authenticationToken);                              // does not work

gradle

// Spring Framework
implementation 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
0 Answers
Related