막무가내 삽질 블로그

API LEVEL 21미만 SSL handshake aborted 문제(okhttp) 본문

Android

API LEVEL 21미만 SSL handshake aborted 문제(okhttp)

joong~ 2022. 1. 24. 17:41
728x90

minsdk 17로 설정 후 작업 중 만난 에러

 

간략히 설명하면 okhttp의 버전 문제임

 

okhttp 3버전은 2.3이상 java 1.7이상을 타겟팅함. 헌데, tls 1.2를 지원하지 않음.

(tls = SSL 프로토콜 형모델로써 암호화 보안 프로토콜)

 

여러 해외 블로그들의 내용을 조합해 맞춤 설정함

 

okhttpclinet 주입 시 connectionspec 리스트를 주입

application에서 Security 설정

위에꺼, oncreate로 설정해야함(멀티덱스할때 깜빡하고 집어넣음)

 

retrofit version = 2.6.0

okhttp version = 3.+

 

 

좀 더 공부예정ㅇㅇㅇ

 

 

참고는 여기

https://developer.android.com/reference/javax/net/ssl/SSLEngine

 

SSLEngine  |  Android Developers

 

developer.android.com

 

https://stackoverflow.com/questions/56818660/how-to-fix-expected-android-api-level-21-but-was-19-in-android

 

How to fix Expected Android API level 21+ but was 19 in Android

In my application i want get data from server, for get connect to server i used Retrofit, OkHttp. But when running application, show me force close error. In android api 21+ is not error, but below...

stackoverflow.com

 

https://medium.com/square-corner-blog/okhttp-3-13-requires-android-5-818bb78d07ce

 

OkHttp 3.13 Requires Android 5+

Today we’re releasing OkHttp 3.13

medium.com

 

https://github.com/square/okhttp

 

GitHub - square/okhttp: Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

Square’s meticulous HTTP client for the JVM, Android, and GraalVM. - GitHub - square/okhttp: Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

github.com

 

https://square.github.io/okhttp/

 

OkHttp

OkHttp HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth. OkHttp is an HTTP client that’s efficient by default: HTTP/2 support allows all requests to

square.github.io

 

https://square.github.io/okhttp/4.x/okhttp/okhttp3/-connection-spec/

 

ConnectionSpec - OkHttp - OkHttp

okhttp / okhttp3 / ConnectionSpec ConnectionSpec class ConnectionSpec Specifies configuration for the socket connection that HTTP traffic travels through. For https: URLs, this includes the TLS version and cipher suites to use when negotiating a secure con

square.github.io

 

'Android' 카테고리의 다른 글

Mavericks - 2  (0) 2022.03.20
Mavericks - 1  (0) 2022.03.19
indexoutofboundsexception staggeredgridlayoutmanaer$span.calculatecachedstart  (0) 2022.01.02
room one to many  (0) 2022.01.02
fragmentstateadapter add, remove fragment error (작성 중)  (0) 2022.01.01
Comments