NoConnectionError. ClearTextHTTP traffic

 

1. 오류상세

   - com.android.volley.NoConnectonError: java.io.IOException:

     ClearText HTTP traffic to192.168.000.000 not permitted

 

2. 사용 Libaray

   - volley

 

3. 발생이유

   - 예전에는 http호출로 인터넷이 접속 되었지만 google정책변경으로

     http접속을 차단하고 https만 가능하도록 했다.

   - SDK 28버전 부터 https를 통한 연결만 가능하도록 했다.

 

4. 해결방안

   - 보안 연결인 TLS(Transport Layer Security)연결을 사용 해야 한다.

   - 관련 Link.

   - 방안1: 장점 : 모든 ip 가능

             : Manifest.xml 파일의 Application내에

              android:userClearTextTraffic="true" 를 추가하면

              http 연결을 허용하게 된다.

   - 방안2: 단점 - 저장한 ip만 가능

             : 파일생성 - res>xml>network_security_config.xml
             : 파일내용 -

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">192.168.000.000</domain>
    </domain-config>
</network-security-config>

            :  Manifest.xml 파일의 Application내에

               android:networkSecurityConfig="@xml/network_security_config"

 

..

 

Posted by 농부지기
,