question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes with failed to initialise OKHTTP client in pre-21 devices

See original GitHub issue

Summary:

App crashes with failed to initialize OKHTTP client in pre-LoliPop devices Steps to reproduce:

How can we reproduce the issue? Open the app in [19]- devices

System logs:

java.lang.ExceptionInInitializerError
at okhttp3.internal.platform.Platform$Companion.findPlatform(Platform.kt:211)
at okhttp3.internal.platform.Platform$Companion.access$findPlatform(Platform.kt:179)
at okhttp3.internal.platform.Platform.<clinit>(Platform.kt:180)
at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:219)
at okhttp3.OkHttpClient$Builder.build(OkHttpClient.kt:955)
at fr.free.nrw.commons.OkHttpConnectionFactory.createClient(OkHttpConnectionFactory.java:38)
at fr.free.nrw.commons.OkHttpConnectionFactory.<clinit>(OkHttpConnectionFactory.java:24)
at fr.free.nrw.commons.CommonsAppAdapter.getOkHttpClient(CommonsAppAdapter.java:39)
at org.wikipedia.dataclient.ServiceFactory.createRetrofit(ServiceFactory.java:60)
at org.wikipedia.dataclient.ServiceFactory.get(ServiceFactory.java:27)
at fr.free.nrw.commons.auth.LoginActivity.doLogin(LoginActivity.java:262)
at fr.free.nrw.commons.auth.LoginActivity.performLogin(LoginActivity.java:257)
at fr.free.nrw.commons.auth.LoginActivity_ViewBinding$1.doClick(LoginActivity_ViewBinding.java:53)
at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:18)
at android.view.View.performClick(View.java:4640)
at android.view.View$PerformClick.run(View.java:19421)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 19
at okhttp3.internal.platform.AndroidPlatform.<clinit>(AndroidPlatform.kt:232)

Device and Android version: ANDROID_VERSION=4.4.2 PHONE_MODEL=GT-N5110 Commons app version: 2.12.3

Screen-shots: NA

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
macgillscommented, May 8, 2020

Downgrade okhttp, safest all around, if we want to upgrade the sdk we can open an issue and discuss it there

0reactions
ashishkumar468commented, May 8, 2020

Hi @macgills @misaochan Do we have a conclusion on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

new OkhttpClient() crash on android 4.4 #4746 - GitHub
version:3.14.0 android-version:4.4 crash-code: new OkhttpClient(); ... App crashes with failed to initialise OKHTTP client in pre-21 devices ...
Read more >
Crashing when first time try OkHttp as a client - Stack Overflow
The error is caused due to execution of network request on main thread (a.k.a. UI thread). In general, thread blocking operations (like file ......
Read more >
Crash on okhttp3 client after updating Android app to v6.3.1
After updating to v6.3.1 in Android, the app crashes on okhttp3 client: LOCATION Cache.java line 233 in `okhttp3.Cache.update$okhttp()` ...
Read more >
PI83412: ANDROID APP WOULD CRASH AFTER UPGRADE ...
After upgrading from OkHttp 3.0.1 to 3.1.0 Android App crash and get the ... Closed as program error. ... <init>(OkHttpClient.java:187) at okhttp3.
Read more >
Ktor-client OkHttp exceptions crash Android app
SocketException: Software caused connection abort in a following scenario: Start streaming with client.get<HttpStatement>(url).execute { . Disable Internet on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found