I am developing an mobile application using IBM MobileFirst Plaform.
我正在使用IBM MobileFirst Plaform开发移动应用程序。
When I test the app in the browser, Mobile simulator and android emulator the application is working fine. When I deploy the apk file in my android device and run the application is not running. when I checked the logcat I have the following error.
当我在浏览器,移动模拟器和Android模拟器中测试应用程序时,应用程序运行正常。当我在我的Android设备中部署apk文件并运行应用程序时没有运行。当我检查logcat时,我有以下错误。
I/Web Console(20334): processMessage failed: Message: F09 WLAuthorizationManagerPlugin1268447688 {"wlFailureStatus":"UNRESPONSIVE_HOST","status":500,"responseText":"","statusText":"The service is currently not available."} at file:///android_asset/www/default/worklight/cordova.js:1063
I / Web控制台(20334):processMessage失败:消息:F09 WLAuthorizationManagerPlugin1268447688 {“wlFailureStatus”:“UNRESPONSIVE_HOST”,“status”:500,“responseText”:“”,“statusText”:“该服务当前不可用。” } at file:///android_asset/www/default/worklight/cordova.js:1063
Both my laptop and Mobile are connected to same wifi network
我的笔记本电脑和手机都连接到同一个wifi网络
3 个解决方案
#1
Your server is likely set to "localhost".
您的服务器可能设置为“localhost”。
- Open the Servers view in Eclipse
- Double-click on "MobileFirst Development Server"
- Change the host value to the IP address of your machine (if you have several IP addresses, be sure you use the correct one)
- Re-start the server (should happen automatically after saving your changes in step 3)
- Re-build the application by right-clicking on the app folder > Run As > Run on MobileFirst Development Server (this ensures the set IP address will propogate to the project's wlclient.properties file)
- Delete the application from the device
- Re-install the newly generated application (from step 5)
在Eclipse中打开Servers视图
双击“MobileFirst Development Server”
将主机值更改为您的计算机的IP地址(如果您有多个IP地址,请确保使用正确的IP地址)
重新启动服务器(应在步骤3中保存更改后自动执行)
通过右键单击应用程序文件夹>运行方式>在MobileFirst Development Server上运行来重新构建应用程序(这可确保设置的IP地址将传播到项目的wlclient.properties文件)
从设备中删除应用程序
重新安装新生成的应用程序(从步骤5开始)
Verify that the application is now able to connect to the MFP Server.
验证应用程序现在是否能够连接到MFP服务器。
#2
Did you check wlclient.properties file in native android folder?? In that file check wlserverhost and wlserver port. Before that if you deploy your app to any remote server that ip address and port number should configured for android environment. Change that IP address and port number by un-check Build the application to work with a different Mobile first server... Re build the application to the local mobile first server..
你检查了原生android文件夹中的wlclient.properties文件吗?在该文件中检查wlserverhost和wlserver端口。在此之前,如果您将应用程序部署到任何远程服务器,应为Android环境配置IP地址和端口号。通过取消选中更改该IP地址和端口号构建应用程序以使用其他Mobile第一台服务器...重新构建应用程序到本地移动第一台服务器..
#3
Para eclipse luna 4.4.0 and WORKLIGHT 6.3
Para eclipse luna 4.4.0和WORKLIGHT 6.3
function wlCommonInit() {
//set url de conexion para Android
var environment = WL.Client.getEnvironment();
if (environment == WL.Environment.ANDROID) {
WL.App.setServerUrl("https://<SERVER>: <PORT>/<contextPATH>",setServerURLSuccess, setServerURLFailure);
}
........
};
and create two methods
并创建两个方法
function setServerURLSuccess() {
// Display the newly set server URL.
//alert(getServerURL());
}
function setServerURLFailure() {
WL.SimpleDialog.show(
"Change Server URL", "Failed setting Server URL",
[{
text: "Close", handler: function() {}
}]
)
}
Saludos!!!
#1
Your server is likely set to "localhost".
您的服务器可能设置为“localhost”。
- Open the Servers view in Eclipse
- Double-click on "MobileFirst Development Server"
- Change the host value to the IP address of your machine (if you have several IP addresses, be sure you use the correct one)
- Re-start the server (should happen automatically after saving your changes in step 3)
- Re-build the application by right-clicking on the app folder > Run As > Run on MobileFirst Development Server (this ensures the set IP address will propogate to the project's wlclient.properties file)
- Delete the application from the device
- Re-install the newly generated application (from step 5)
在Eclipse中打开Servers视图
双击“MobileFirst Development Server”
将主机值更改为您的计算机的IP地址(如果您有多个IP地址,请确保使用正确的IP地址)
重新启动服务器(应在步骤3中保存更改后自动执行)
通过右键单击应用程序文件夹>运行方式>在MobileFirst Development Server上运行来重新构建应用程序(这可确保设置的IP地址将传播到项目的wlclient.properties文件)
从设备中删除应用程序
重新安装新生成的应用程序(从步骤5开始)
Verify that the application is now able to connect to the MFP Server.
验证应用程序现在是否能够连接到MFP服务器。
#2
Did you check wlclient.properties file in native android folder?? In that file check wlserverhost and wlserver port. Before that if you deploy your app to any remote server that ip address and port number should configured for android environment. Change that IP address and port number by un-check Build the application to work with a different Mobile first server... Re build the application to the local mobile first server..
你检查了原生android文件夹中的wlclient.properties文件吗?在该文件中检查wlserverhost和wlserver端口。在此之前,如果您将应用程序部署到任何远程服务器,应为Android环境配置IP地址和端口号。通过取消选中更改该IP地址和端口号构建应用程序以使用其他Mobile第一台服务器...重新构建应用程序到本地移动第一台服务器..
#3
Para eclipse luna 4.4.0 and WORKLIGHT 6.3
Para eclipse luna 4.4.0和WORKLIGHT 6.3
function wlCommonInit() {
//set url de conexion para Android
var environment = WL.Client.getEnvironment();
if (environment == WL.Environment.ANDROID) {
WL.App.setServerUrl("https://<SERVER>: <PORT>/<contextPATH>",setServerURLSuccess, setServerURLFailure);
}
........
};
and create two methods
并创建两个方法
function setServerURLSuccess() {
// Display the newly set server URL.
//alert(getServerURL());
}
function setServerURLFailure() {
WL.SimpleDialog.show(
"Change Server URL", "Failed setting Server URL",
[{
text: "Close", handler: function() {}
}]
)
}
Saludos!!!