728x90
반응형
이번 포스팅은 간단한? 오류 해결 방법을 포스팅해보겠다.
프로젝트에서 웹뷰로 불러와야 하는 화면이 있는데 그래서 당연히 웹뷰를 구현해 로드를 하면 될 줄 알았다. 하지만 역시 한 번에 되기란 쉽지 않고 아래 사진처럼 사용 시 "웹페이지를 사용할 수 없음"이라는 오류가 발생하였다.

# 오류 원인
내가 요청하고자 했던 URL은 http로 시작하였다 보통은 https지만 http라서 접근이 안 됐던 것이었다!
# 해결 방법
해결방법은 다른 방법이 있는지 모르겠는데 manifest - application안에 다음 라인을 추가해주면 된다.
android:usesCleartextTraffic="true"
<application
android:name="ExampleApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
// 아래 줄 추가
android:usesCleartextTraffic="true">
위 코드는 예시 application코드이다
혹여나 안된다면 manifest에 인터넷 권한을 추가했는지도 살펴보길 바란다! 안 돼있으면 다음 코드를 manifest에 추가해보면 될 것이다!
<uses-permission android:name="android.permission.INTERNET" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.">
// 추가
<uses-permission android:name="android.permission.INTERNET" />
...
...
위 코드는 전체 manifest예시 코드이다

참고 사이트
https://eunoia3jy.tistory.com/16
반응형