나는이 최신 버전이 호환 가능할 것으로 생각했습니다. 이 트윗이있다. https://twitter.com/JakeWharton/status/553066921675857922 및 Retrofit 1.9의 변경 내역에도 언급되어 있습니다.Okhttp 2.2 및 인터셉터를 사용하여 1.9를 개조
OkHttpClient httpClient = new OkHttpClient();
httpClient.interceptors().add(new TokenExpiredInterceptor());
mRestAdapter = new RestAdapter.Builder()
.setEndpoint(API_ENDPOINT)
.setClient(httpClient)
.setLogLevel(BuildConfig.DEBUG ?
RestAdapter.LogLevel.FULL :
RestAdapter.LogLevel.NONE)
.setRequestInterceptor(new AuthorizationInterceptor())
.build();
그것은 여전히 작동하지 않습니다
그러나 나는이 때. setClient 메소드는 호환되지 않는 Client 객체에 대해 불평합니다.
Error:(29, 21) error: no suitable method found for setClient(OkHttpClient)
method Builder.setClient(Client) is not applicable
(argument mismatch; OkHttpClient cannot be converted to Client)
method Builder.setClient(Provider) is not applicable
(argument mismatch; OkHttpClient cannot be converted to Provider)
무엇이 누락 되었습니까? 또한 OkHttpClient가 Client 인터페이스를 구현하지 않음을 알 수 있습니다.
지금이 방법을 사용하고 있습니다. https://medium.com/@nullthemall/execute-retrofit-requests-directly-on-okhttp-2-2-7e919d87b64e
변경 내역을 잘못 해석 했습니까? Maye Retrofit 1.9는 classpath에있을 때 OkHttpClient 2.2를 사용할 수 있지만 인터페이스가 아직 개조되지 않았습니까?
감사를 구현
OkHttpClient
에OkClient
인스턴스를 전달한다! 내가 이것을 놓쳤다는 것을 믿을 수 없다 : p – dzan@UsmanAfzal 이것은 질문과 관련이 없기 때문에 누군가가이 문제를 전에 가지고 있는지 또는 자신의 질문을해야하는지 검색해야한다. –