0
Q:

at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.onFailure(DefaultCallAdapterFactory.java:96)

android {
    compileOptions {
        targetCompatibility = "8"
        sourceCompatibility = "8"
    }
}
0
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)
    }
}
0

New to Communities?

Join the community