0
0

More than 1 year has passed since last update.

Androidのhttp requestで詰まったところ

Last updated at Posted at 2023-04-04

公式 (https://developer.android.com/training/volley/simple?hl=ja#kotlin) のサンプルを使用したときに、"That didn't work!"になってしまった。

調べたところ、api level 28 からhttp通信がデフォルトで無効になっているとのこと。
サンプルは http://www.google.com を指定していたので、通信できなかった。

解決法

  • http:// -> https:// に変更
  • AndroidManifest の application に android:usesCleartextTraffic="true" を追記
  • res/xml/network_security_config.xml を作成する
0
0
0

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