MobileFirst Hybrid Development - HTTP Adapter not working on device

≯℡__Kan透↙ 提交于 2019-12-25 03:32:44

问题


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.

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.

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


回答1:


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

wlServerProtocol = http
wlServerHost = 192.168.0.19
wlServerPort = 10080

Don't edit them directly, rather use

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

to specify the URL and then rebuild the project.

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



来源:https://stackoverflow.com/questions/29664406/mobilefirst-hybrid-development-http-adapter-not-working-on-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!