连接Android设备要在本地主机上的Web服务要在、机上、地主、设备

2023-09-12 07:18:28 作者:沦丧

我实现了一个Web服务的Andr​​oid应用程序。 Web服务是我的本地主机(192.168.1.2)上运行。使用Android模拟器我成功连接到Web服务。在我尝试使用调试模式的Web服务连接Android设备,但没有奏效。所以我的问题是,如果有可能的Andr​​oid设备连接到我的本地主机(192.168.1.2)上不使用真实IP上运行此Web服务?

I implemented a web service for an Android application. The web service is running on my local host (192.168.1.2). Using the Android emulator I succeeded to connect to web service. The I tried to connect my Android device using debugging mode to web service but it didn't work. So my question is if it is possible to connect an Android device to this web service that is running on my local host (192.168.1.2) without using a real IP ?

推荐答案

您是否已经解决问题了吗?我也有一个问题,像你这样的。这些是我已经完成的步骤:

Did you already solve your problem? I also got a problem like you. These are the steps that I already done:

在拔掉LAN电缆或关闭您的电脑的任何其他互联网连接。 您的Andr​​oid手机使用USB连接到PC。 在开启USB绑定 返回到您的电脑。检查你的IP。我的是192.168.42.37 检查你的电脑的Web服务应用程序。让我们说 http://192.168.42.37/webserviceapp 回到你的Andr​​oid手机。试试这个网址 http://192.168.42.37/webserviceapp

现在你可以从你的手机访问Web服务的应用程序在你的电脑。

Now you can access your webservice app in your pc from your mobile phone.