728x90

OKHttp3 2

[OKHttp3] java.lang.NullPointerException: Attempt to get length of null array / BasicTrustRootIndex 관련 에러 처리

오늘은 OKHttp3 에서 발생하는 에러 처리를 다루어 보겠다.OKHttp3에서 원활한 https 를 접속하기 위해서 대부분 인증서를 무시하는 코드를 함께 넣어서 client 를 빌드해서 사용하는 경우가 많다.그 때 흔하게 발생하는 에러 중 하나는 아래의 에러이다.java.lang.NullPointerException: Attempt to get length of null array,BasicTrustRootIndex 관련 메세지들.. 위의 에러는 주로 아래 코드가 문제가 된다. 아래의 getAcceptedIssuers() 의 return null; 이 부분이 문제./** * UnCertificated 허용 */ public static OkHttpClient.Builder configureClient(..

IT/Android 2018.11.29

Android OKHttp3 에서 발생하는 NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Platform

안드로이드에서 OKHttp를 사용하여 웹과 통신하는 경우가 빈번하다.OKHttp3 를 사용하다보면 발생하는 에러 중 하나가 다음과 같다. Error java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Platform; OKHttp 에서 필요한 클래스를 찾지 못해서 발생하는 에러이다. App build.gradle로 가서 OKHttp3 의 버전을 업그레이드 하면 대부분 해결이 된다. implementation 'com.squareup.okhttp3:okhttp:3.4.1' implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1' implementation 'com.squa..

IT/Android 2018.11.08
728x90