android - 从安装到 Android 设备的 Appcelerator 移动应用访问本地运行的服务器

标签 android tomcat android-emulator appcelerator

我有一个在我的机器上本地运行的 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

How can i access my localhost from my android device?

关于android - 从安装到 Android 设备的 Appcelerator 移动应用访问本地运行的服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10685187/

相关文章:

Android outofmemory 错误位图大小超过 2.3.3 中的 vm 预算

Android:处理从服务器连续拉取的最佳方式?

java - 更新 Android 中 CalendarView 中输入的日期

tomcat - 为什么在Spring Boot 1.1.9.RELEASE中没有Tomcat错误页面

java - 如何摆脱 PermGen 空间?

android - Android Virtual Device Manager下 'Wipe Data'函数到底是做什么的

android - 新手 : How to change tab font size?

android - ImageButton 的 Material Design 指南是什么?

android - 将 Realm 与协程一起使用时从不正确的线程访问 Realm

生产环境的 Tomcat MaxThreads 数量