Android Question App crashing on okhttp3 in some old tablet

EduardoElias

Well-Known Member
Licensed User
Longtime User
I am testing my app in several tablets new and old ones and i see that in samsung tab e 7 (SM-t111) android 4.2.2 I started to get this error after upgraded from okhttp2 (and B4A from the old toolchain)

B4X:
Logger connected to:  samsung SM-T111M
--------- beginning of /dev/log/main
Copying updated assets files (112)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
**************************
********DASHEN*********
**************************
yAppManager.Initialize
samsung-SM-T111M-goya3gub
yConfig.Initialize
yConfig.LoadConfig
yAppManager.OnLoginFail Timer Started
yAppManagerAct.Initialize
yAppManager.Initialize
ySQLTable.CreateTAble SQLFieldList codigo TEXT, imagem TEXT
Reconectando Servidor
yClientIssuer.StartServices StartTimer.Enabled false FSSList 0 FSSCount 0
yConfig.OnStartServices Count0
yClientIssuer.StartServiceNext Enabledtrue
yClientIssuer.StartServices yConfig Count 1
Panel size is unknown. Layout may not be loaded correctly.
JumpToPanel Pinpad
JumpToPanel Inicio
ySlidingPanels.CreateButtons AuxPanel <> cAuxPanel.None
JumpToPanel Ferramentas
** Activity (main) Resume **
LogSplash (IndexOutOfBoundsException) java.lang.IndexOutOfBoundsException: Invalid index 2, size is 1
LogSplash (IndexOutOfBoundsException) java.lang.IndexOutOfBoundsException: Invalid index 3, size is 2
LogSplash (IndexOutOfBoundsException) java.lang.IndexOutOfBoundsException: Invalid index 4, size is 3
LogSplash (IndexOutOfBoundsException) java.lang.IndexOutOfBoundsException: Invalid index 5, size is 4
yClientIssuer.StartServices StartTimer.Enabled true FSSList 0 FSSCount 1
yConfig.OnStartServices Count1
yClientIssuer.StartServices yConfig Count 1
yBroadcastClientService Broadcast IP Found 192.168.0.255
** Service (ybroadcastclientservice) Start **
yBroadcastClientService Broadcast IP Found 192.168.0.255
** Service (ybroadcastclientservice) Start **
*** Service (httputils2service) Create ***
java.lang.ExceptionInInitializerError
    at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:237)
    at okhttp3.OkHttpClient$Builder.build(OkHttpClient.kt:1069)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.Initialize(OkHttpClientWrapper.java:94)
    at yashar.yDashen.httputils2service._service_create(httputils2service.java:320)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at yashar.yDashen.httputils2service.onCreate(httputils2service.java:56)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2605)
    at android.app.ActivityThread.access$1700(ActivityThread.java:153)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:5302)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
    at okhttp3.internal.platform.Platform$Companion.findAndroidPlatform(Platform.kt:219)
    at okhttp3.internal.platform.Platform$Companion.findPlatform(Platform.kt:212)
    at okhttp3.internal.platform.Platform$Companion.access$findPlatform(Platform.kt:169)
    at okhttp3.internal.platform.Platform.<clinit>(Platform.kt:170)
    ... 25 more
Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 17
    at okhttp3.internal.platform.AndroidPlatform.<clinit>(AndroidPlatform.kt:153)
    ... 29 more
--------- beginning of /dev/log/system
--------- beginning of /dev/log/system

It is working in several other androids, like 4.4.4 and new ones either

Any clue?
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
Yes it will work only on android 5+
is there an alternative to deal with that.. because I have a lot of users with tablets that are version 4... Samsung sold a lot of Tab e down here until recently based on 4.4.4....

is it possible to use the previous OkHttp if detected this old android versions ?
 
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
 
Upvote 0
Top