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
Any suggestions on this, @maskaravivek @neslihanturan @macgills. The solution I have come to is degrading the okhttp version. Do you guys think there could be a better way to do this?
Degrade, okhttp later versions require android 5.0.
Or upgrade our minSDK, I don't have access to our statistics to see how many users would be affected

Upgrading to 21 is something not we are considering as of now, I remember having a discussion regarding this with @misaochan . Seems like the only option is to degrade okhttp, waiting for input from others.
Removing access from 5.9% of devices is a lot, especially given that we are targeting underrepresented (i.e. global south) countries. If it was possible to degrade okhttp without adverse effect I would strongly prefer that.

4% as we already do not target all devices. I don't have any data to point to about the SDK levels of android by region as these are only global figures but they are global so 3/2 might not shock me for a particular region but *10 certainly would
Hi @macgills @misaochan Do we have a conclusion on this?
Downgrade okhttp, safest all around, if we want to upgrade the sdk we can open an issue and discuss it there
Most helpful comment
Downgrade okhttp, safest all around, if we want to upgrade the sdk we can open an issue and discuss it there