(1) 발생 시점
웹뷰가 동작하는 애플리케이션을 만들어보던 중,
Adapter에 URL을 걸어주었더니 아래와 같은 예외메시지가 나오면서
웹뷰에 URL에 해당하는 사이트가 나오지 않았다.
(2) 발생 원인
API 28 이상의 버전부터 생긴 강화된 네트워크 보안정책으로 인한 오류였다.
(3) 해결 방법
Case1. AndroidManifest.xml의 application 태그 내부에 Cleartext 네트워크 트래픽 허용처리
android:usesCleartextTraffic = "true"
Case2. networkSecurityConfig 파일 생성 후, Manifest에 추가
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">api.example.com(to be adjusted)</domain>
</domain-config>
</network-security-config>
android:networkSecurityConfig="@xml/network_security_config"
Case3. URL이 Http:// 인 경우에 Https:// 로 변경
'Error' 카테고리의 다른 글
[Error] Plugin 설정 중, JCEF 런타임 재설치 및 GPU 이슈 (0) | 2024.02.25 |
---|