English 中文(简体)
OkHttpClient Inhuman in InitializerError
原标题:OkHttpClient ExceptionInInitializerError

First time using httpOk and retrofit. I m using the code of another employee, but can t make it work, even after going into internet to check what is the potential error.

public static Retrofit getBsfBuilder() {
    HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
    OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();

    retrofit = new Retrofit.Builder()
            .baseUrl(BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .client(client)
            .build();

     return retrofit;
}

随着上述《联邦公报》的宣布,以及《联邦公报》的改版。

错误

E/AndroidRuntime: FATAL EXCEPTION: main Process: , PID: 5305 java.lang.ExceptionInInitializerError

问题回答

问题在于,我使用了第19版和roid版,最新版本为okhttp://stackoverflow.com/questions/56818660/how-to-fix-expected-android-api-level-21-but-was-19-in-android>。 • 如何固定预期的APIC第21+级,但为19个,用于更多的信息

更新<代码>OkHttp图书馆。

implementation ("com.squareup.okhttp3:okhttp:4.9.0")




相关问题
How to solve Admobi error cannot find symbol?

In my Gradel build I use ` dependencies {implementation com.google.android.gms:play-services-ads:20.4.0 implementation com.google.firebase:firebase-auth:21.0.3 ...

TextView going out of bound in grid layout

Two text view is not visible some ways to fix it is giving end margin, remove the icon or wrap it with frame layout. I m not able to understand what is causing this issue and which is the better way ...

热门标签