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.

new OkhttpClient() crash on android 4.4

See original GitHub issue

version:3.14.0 android-version:4.4

crash-code: new OkhttpClient();

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

java8 is already configured

why?

log:

03-19 13:01:19.857 25428-25428/com.syiyi.vote E/AndroidRuntime: FATAL EXCEPTION: main Process: com.syiyi.vote, PID: 25428 java.lang.ExceptionInInitializerError at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263) at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229) at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015) at com.syiyi.vote.util.ConfigManager.loadConfig(ConfigManager.kt:16) at com.syiyi.vote.page.main.MainActivity$hmasTest$1.run(MainActivity.kt:69) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5314) 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:864) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680) 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.buildIfSupported(AndroidPlatform.java:238) at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202) at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79) at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)  at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)  at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)  at com.syiyi.vote.util.ConfigManager.loadConfig(ConfigManager.kt:16)  at com.syiyi.vote.page.main.MainActivity$hmasTest$1.run(MainActivity.kt:69)  at android.os.Handler.handleCallback(Handler.java:733)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5314)  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:864)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)  at dalvik.system.NativeStart.main(Native Method)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Okhttp3.CertificatePinner error in android 4 just in release APK
Just in Release version and on belowe android5 app crashed on the line below: OkHttpClient.Builder httpClient = new OkHttpClient().
Read more >
OkHttp 3.X on Android 4.4.4 - bendb
This morning I was greeted at work by an unexpectedly-large number of crashes from a new Android release. As it happens, OkHttp 3....
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 following stack trace and crash after calling build() to create...
Read more >
4.x Change Log - OkHttp
Fix: Work around a crash in Android 10 and 11 that may be triggered when two threads ... New: Add cacheHit , cacheMiss...
Read more >
3.x Change Log - OkHttp
Fix: Don't crash on Android 11 due to use of restricted methods. ... New: We've added requestFailed() and responseFailed() methods to EventListener ....
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