我有一个在我的机器上本地运行的 Spring Restful API 服务器。
我通过 Eclipse 的服务器选项卡将其作为 Tomcat 应用程序服务器启动/停止。
我还构建了一个可以调用此服务器的 Appcelerator 应用。
当我通过 Titatium Studio 中的 Android Emulator 选项运行我的应用时,它可以很好地连接和检索数据从我的本地服务器。 请求是:
var TRANSACTIONS_URL = 'http://myipaddress:8080/PurchaseAPIServer/api/purchase';
当我通过 USB 电缆(在开发者模式下)将我的 Android 设备连接到机器并使用 Android 设备 安装/运行应用程序时遇到问题>Titanium Studio。
我本地运行的服务器从未被攻击过。
我已经尝试过本文中提到的选项,但没有成功: Accessing webserver running within Eclipse from outside the workstation
有办法解决这个问题吗?
谢谢
最佳答案
将我的 Samsung Galaxy S2 连接到本地 wifi 连接(PC 使用相同的 wifi)解决了这个问题。一旦安装在设备上,当然也不需要 USB 电缆。
以下链接可能有用:
Accessing localhost of PC from USB connected Android mobile device
关于android - 从安装到 Android 设备的 Appcelerator 移动应用访问本地运行的服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10685187/