Reputation: 365
Here are my dependencies,
//retrofit and gson dependencies
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
and code which uses HttpLoggingInterceptor is like this,
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
retrofit = new Retrofit.Builder()
.baseUrl(URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create())
.build();
I have refered to this question and for error which I am getting, they said update dependecies version.I have tried all versions of okHttp.logging-Interceptor but still its not working.Can anyone have any idea where I'm going wrong.
Upvotes: 0
Views: 5951
Reputation: 1257
Just add the same version in all libraries related to Retrofit or change or update the versions. this problem seems is related to conflict versions.
Upvotes: 1
Reputation: 5892
Just tested your code, everything seems fine . Please clean your and re-run .
Upvotes: 3