Android connection to localhost

前端 未结 9 491
囚心锁ツ
囚心锁ツ 2020-12-01 11:23

I\'m trying to connect my android application to a local host url thanks to wamp server but it doesn\'t work. My goal here, is to fetch json data and parse these data. For m

相关标签:
9条回答
  • 2020-12-01 11:47

    I assume you are trying to access web service available on your PC from either an android simulator or a real device.

    For an android emulator, you must NOT just use "localhost", because "localhost" means android emulator itself, NOT the host PC.

    you need modify the /etc/hosts file or the simulator or real device. add a line like "192.168.0.100 service.local".

    0 讨论(0)
  • 2020-12-01 11:48

    if you are using your phone instead of emulator and running services on localhost then in url instead of '10.0.2.2' use IP address of your PC.

    0 讨论(0)
  • 2020-12-01 11:48

    Just Install the "conveyor by Keyoti" the extension in Visual studio and it will generate a url according to your ip address automatically. here's the link:

    conveyor

    so far so good....!

    0 讨论(0)
提交回复
热议问题