My App is crashing on Android 11 with the following log:
2021-01-01 18:16:52.556 10648-10648/com.myapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapp, PID: 10648
java.lang.ExceptionInInitializerError
at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:211)
at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:204)
at retrofit2.Retrofit$Builder.build(Retrofit.java:628)
at com.myapp.MyApplication.onCreate
OkHttp is an efficient HTTP & HTTP/2 client for Android and Java applications. It comes with advanced features, such as connection pooling (if HTTP/2 isn't available), transparent GZIP compression, and response caching, to avoid the network completely for repeated requests.
OkHttp android provides an implementation of HttpURLConnection and Apache Client interfaces by working directly on a top of java Socket without using any extra dependencies.
OkHttp is an HTTP client from Square for Java and Android applications. It's designed to load resources faster and save bandwidth. OkHttp is widely used in open-source projects and is the backbone of libraries like Retrofit, Picasso, and many others.
Beginning with Mobile SDK 4.2, the Android REST request system uses OkHttp (v3. 2.0), an open-source external library from Square Open Source, as its underlying architecture. This library replaces the Google Volley library from past releases.
In my case I was using:
implementation 'com.squareup.okhttp3:logging-interceptor:4.0.1'
Updating okHttp to version 4.4.0 fixes the problem.
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.0'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With