본문 바로가기
Error

java.net.UnknownServiceException: CLEARTEXT communication to [] not permitted by network security policy

by pavi03 2022. 5. 10.

[kotlin]

 

Caused by: java.net.UnknownServiceException: CLEARTEXT communication to 3.37.140.224 not permitted by network security policy
        at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:188)
        at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
        at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
        at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
        at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
        at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
        at com.apollographql.apollo3.network.http.DefaultHttpEngine.execute(OkHttpEngine.kt:69)

 


network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>
<application
    ...
    android:networkSecurityConfig="@xml/network_security_config">



https://gun0912.tistory.com/80

 

[안드로이드]CLEARTEXT communication to XXXX not permitted by network security policy

"CLEARTEXT communication to XXXX not permitted by network security policy" 어느날 코드를 바꾼게 없는데도 위와 같은 오류가 발생하면서 앱이 실행이 안되는 일이 발생합니다. 그 이유는 여러분 혹은 사용자..

gun0912.tistory.com