new OkhttpClient() crash on android 4.4
See original GitHub issueversion: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:
- Created 5 years ago
- Reactions:2
- Comments:13 (5 by maintainers)
Top GitHub Comments
@davidlad123 OkHttp 4.9.0 doesn’t support API 19. https://square.github.io/okhttp/security/
https://medium.com/square-corner-blog/okhttp-3-13-requires-android-5-818bb78d07ce