简体   繁体   English

我应该使用哪个IP地址将MySQL与Android设备连接

[英]What IP address should I use to connect MySQL with Android Device

I'm working with Android Studio (I guess in other IDEs same happens) and I'm trying test my app in device android from USB. 我正在使用Android Studio(我想在其他IDE中也会发生这种情况),并且正在尝试通过USB在设备android中测试我的应用。

The app work with a mysql database in localhost (local server). 该应用程序可与本地主机(本地服务器)中的mysql数据库一起使用。 When I emulate the app with AVD works fine with IP 10.0.2.2, but when test this in my device doesn't work with IP 10.0.2.2 or 127.0.0.1 or IP Lan 192.168.1.138. 当我使用AVD模拟应用程序时,可以在IP 10.0.2.2上正常工作,但是在我的设备中进行测试时,不能在IP 10.0.2.2或127.0.0.1或IP Lan 192.168.1.138下工作。

What IP address should I use? 我应该使用哪个IP地址?

Rather than USB you have to connect your android device in wifi network. 而不是USB,您必须在wifi网络中连接android设备。 And both device and your server PC should be in the same network. 并且设备和服务器PC应该在同一网络中。 Then you can use the IP address of your LAN. 然后,您可以使用局域网的IP地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM