Ejemplo 1: en retrofit2.DefaultCallAdapterFactory $ ExecutorCallbackCall $ 1.onFailure (DefaultCallAdapterFactory.java:96)
class RetrofitService {
private val BASE_URL = "https://jsonplaceholder.typicode.com/"
private val loggingInterceptor = HttpLoggingInterceptor()
private val httpClient = OkHttpClient.Builder().addInterceptor(loggingInterceptor).build()
private val builder = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(httpClient)
private val retrofit = builder.build()
init {
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
}
fun <S> createService(
serviceClass: Class<S>
): S {
return retrofit.create(serviceClass)
}
}
Ejemplo 2: en retrofit2.DefaultCallAdapterFactory $ ExecutorCallbackCall $ 1.onFailure (DefaultCallAdapterFactory.java:96)
android {
compileOptions {
targetCompatibility = "8"
sourceCompatibility = "8"
}
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)