unable to test application in android device

2019-09-17 03:56发布

I am developing an mobile application using 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.

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

Both my laptop and Mobile are connected to same wifi network

3条回答
姐就是有狂的资本
2楼-- · 2019-09-17 04:02

Your server is likely set to "localhost".

  1. Open the Servers view in Eclipse
  2. Double-click on "MobileFirst Development Server"
  3. Change the host value to the IP address of your machine (if you have several IP addresses, be sure you use the correct one)
  4. Re-start the server (should happen automatically after saving your changes in step 3)
  5. 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)
  6. Delete the application from the device
  7. Re-install the newly generated application (from step 5)

Verify that the application is now able to connect to the MFP Server.

查看更多
太酷不给撩
3楼-- · 2019-09-17 04:07

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..

查看更多
Luminary・发光体
4楼-- · 2019-09-17 04:08

Para eclipse luna 4.4.0 and 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!!!

查看更多
登录 后发表回答