LoginSignup
5
3

More than 3 years have passed since last update.

【Android】CLEARTEXT communication to xxxxxx.com not permittedが出た時

Posted at

APIをRetrofitを使い取得しようとしたときにエラーになったのでメモ

CLEARTEXT communication to xxxxxxx.com not permitted by network security policy

http通信が許可されていないことからこのエラーになる。

Manifestにandroid:usesCleartextTraffic="true"を足す

 <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.SimpleRetrofit"
        //下記を足す
        android:usesCleartextTraffic="true"
        >

これで通信許可ができるはず。

5
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3