How to connect to AVD

后端 未结 2 2005
梦毁少年i
梦毁少年i 2021-01-12 18:59

i\'m trying to write my own android http server. It\'s quite OK but i have a problem with my AVD. I don\'t want to download my app to phone everytime I want to test changes.

2条回答
  •  星月不相逢
    2021-01-12 19:07

    While I don't know the answer to your problem directly, I do know that when connecting FROM an AVD TO your computer, you have to use 10.0.2.2 because your AVD is essentially behind another "router". It doesn't get a local lan IP from your router. See this question for more information. From this link, he quotes:

    Each instance of the emulator runs behind a virtual router/firewall service that isolates it from your development machine's network interfaces and settings and from the internet. An emulated device can not see your development machine or other emulator instances on the network. Instead, it sees only that it is connected through Ethernet to a router/firewall.

提交回复
热议问题