LoginSignup
1
1

More than 5 years have passed since last update.

AndroidエミュレータからPCに立てたサーバのテスト

Posted at

サーバサイドのAPIとAndroidアプリを同時に開発している時に、自分のPCをに立てたAPPサーバにリクエストを送る方法

Androidアプリで指定しているAPIのURLのホスト名を10.0.2.2に設定してリクエストする。 例えばローカルに立てたサーバのURLがhttp://localhost:8080/hogeならhttp://10.0.2.2/hogeのように指定する。

エミュレータから見たローカルサーバのIPアドレスが上記のうようになっているためみたいです。

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