Hi, I added amazonaws ivs library, after i added this library I am getting this error on this Lokhttp3/OkHttpClient$Builder.
Below library added on app level build.gradle
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation 'com.amazonaws:ivs-broadcast:1.9.0:stages@aar'
ApiClient.java
public class ApiClient {
private static Retrofit retrofit = null;
private static Retrofit uploadRetrofit = null;
private static final int HTTP_TIMEOUT_MS = 10000;
public static ApiInterface getWebService() { return getClient().create(ApiInterface.class); }
public static Retrofit getClient() {
if (retrofit == null) {
/* HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.level(HttpLoggingInterceptor.Level.BODY);*/
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(HTTP_TIMEOUT_MS, TimeUnit.MILLISECONDS)
.readTimeout(3, TimeUnit.MINUTES)
.writeTimeout(3, TimeUnit.MINUTES)
.addNetworkInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = null;
Request original = chain.request();
// Request customization: add request headers
Log.d("", "intercept: "+ com.app.chobi.model.GetSet.getAuthToken());
Log.d("", "intercept: "+GetSet.getUserId());
Request.Builder requestBuilder = original.newBuilder()
.addHeader(com.app.chobi.utils.Constants.TAG_AUTHORIZATION,
com.app.chobi.model.GetSet.getAuthToken() != null ? com.app.chobi.model.GetSet.getAuthToken() : "")
.addHeader("Connection", "close").
addHeader(com.app.chobi.utils.Constants.TAG_USER_ID, GetSet.getUserId() != null ? GetSet.getUserId() : "");
request = requestBuilder.build();
return chain.proceed(request);
}
})
.build();
retrofit = new Retrofit.Builder()
.baseUrl(Constants.API_URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create())
// .addConverterFactory(ScalarsConverterFactory.create())
.build();
}
return retrofit;
}
public static Retrofit getUploadClient() {
if (uploadRetrofit == null) {
OkHttpClient httpClient = new OkHttpClient.Builder()
.callTimeout(60, TimeUnit.MINUTES)
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(3, TimeUnit.MINUTES)
.writeTimeout(3, TimeUnit.MINUTES).build();
uploadRetrofit = new Retrofit.Builder()
.client(httpClient)
.baseUrl(Constants.API_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return uploadRetrofit;
}
}