커뮤니티

Global It Leader!!


자유게시판

[WebView] ERR_CLEARTEXT_NOT_PERMITTED 오류 해결 방법

페이지 정보

작성자 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 1,766회 작성일 21-03-13 23:01

본문

Option 1 -

First try hitting the URL with "https://" instead of "http://"


Option 2 -

Create file res/xml/network_security_config.xml -

<?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>

AndroidManifest.xml -

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config"
        ...>
        ...
    </application>
</manifest>

Option 3 -

android:usesCleartextTraffic Doc

AndroidManifest.xml -

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>

Also as @david.s' answer pointed out android:targetSandboxVersion can be a problem too -

According to Manifest Docs -

android:targetSandboxVersion

The target sandbox for this app to use. The higher the sandbox version number, the higher the level of security. Its default value is 1; you can also set it to 2. Setting this attribute to 2 switches the app to a different SELinux sandbox. The following restrictions apply to a level 2 sandbox:

  • The default value of usesCleartextTraffic in the Network Security Config is false.
  • Uid sharing is not permitted.

So Option 4 -

If you have android:targetSandboxVersion in <manifest> then reduce it to 1

AndroidManifest.xml -

<?xml version="1.0" encoding="utf-8"?>
<manifest android:targetSandboxVersion="1">
    <uses-permission android:name="android.permission.INTERNET" />
    ...
</manifest>

댓글목록

등록된 댓글이 없습니다.

전체 7
게시물 검색
자유게시판 목록
번호 제목 글쓴이 조회 날짜
7 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 82 01-01
6 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 602 12-21
5 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1551 06-28
열람중 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1767 03-13
3 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1828 01-04
2 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2010 09-29
1 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2012 09-22