MobileFirst混合开发 - HTTP适配器无法在设备上运行 [英] MobileFirst Hybrid Development - HTTP Adapter not working on device

查看:180
本文介绍了MobileFirst混合开发 - HTTP适配器无法在设备上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MobileFirst Hybrid开发的新手,我已经开始了一个原型项目,该项目涉及创建adatpers部署和测试。我能够创建一个javascript adatper(http adatper),它调用web api,我能够在MobileFirstDevelopment Server中部署适配器,在我的情况下,它是我的本地机器。

I am new to MobileFirst Hybrid development and I have started a prototype project which involves creating adatpers deploying and testing. I was able to create a javascript adatper (http adatper), which calls web api, I was able to deploy the adapter in MobileFirstDevelopment Server, in my case it is my local machine.

该项目在移动预览模式下以及在Android模拟器中成功运行,但是当我在真正的Android设备中测试时,适配器功能不起作用。我已经安装了android usb驱动程序,并且可以通过设备调用cordova插件,它只是适配器功能无效。

The project runs successfully in mobile preview mode and also in android emulator, but when I test it in real android device, the adapter functionality does not work. I have installed the android usb drivers and can lauch the application and also call cordova plugins thru device, its just adapter functionality that doesn't work.

LogCat显示[/ app / services / ProjectName / android / query]失败,状态:500响应未定义。

The "LogCat" shows the error as [/app/services/ProjectName/android/query] failed, state:500 response undefined.

推荐答案

您的应用使用服务器的URL构建,当部署到设备时,必须能够看到该URL指定的服务器。通常,设备将处于与模拟器中的网络环境略有不同的网络环境中。

Your app is built with the URL of the server, when deployed to the device it must be possible to "see" the server as specified by that URL. Often the device will be in a subtly different network environment from that in the emulator.

你会在你的应用程序中找到使用的值

You will find the values used in your app in

/android/native/assets/wlclient.properties

/android/native/assets/wlclient.properties

wlServerProtocol = http
wlServerHost = 192.168.0.19
wlServerPort = 10080

不要直接编辑它们,而是使用

Don't edit them directly, rather use

-rightClick->运行方式 - >构建设置和部署目标

-rightClick-> Run As -> Build Settings and Deploy Target

指定URL,然后重建项目。

to specify the URL and then rebuild the project.

长期我建议使用构建脚本来创建可部署的人工制品,并且可以在这些脚本中指定服务器URL。

Longer term I recommend using build scripts to create your deployable artefacts and the server URL can specified in those scripts.

这篇关于MobileFirst混合开发 - HTTP适配器无法在设备上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆