[Android] Cleartext HTTP traffic to 000.000.000.000 not permitted
Cleartext HTTP traffic to not permitted 오류가 발생할 경우
1. http 주소를 https 주소로 변경하면 해결.
2. 1번이 불가능하다면, targetSdkVersion 를 28 미만으로 사용하면 해결.
build.gradle (app) 파일의 targetSdkVersion 를 수정.
3. 1번과 2번이 불가능하다면 (http 를 사용해야만 하고, targetSdk를 28 이상으로 써야 한다면),
앱 매니페스트에 다음과 같이 기입한다.
|
<?xml version=”1.0″ encoding=”utf-8″?> … android:usesCleartextTraffic=”true”> |
도메인별 허용 등 다른 방법도 있다. 다른 방법은 아래 사이트들을 참고할 것.
참고 사이트 : https://gun0912.tistory.com/80
참고 사이트 2 : http://sunphiz.me/wp/archives/3094