简体   繁体   English

无法在android设备中测试应用程序

[英]unable to test application in android device

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. 当我在浏览器,移动模拟器和android模拟器中测试应用程序时,该应用程序运行正常。 When I deploy the apk file in my android device and run the application is not running. 当我在我的android设备中部署apk文件并运行时,该应用程序未运行。 when I checked the logcat I have the following error. 当我检查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”:“该服务当前不可用。” },位于file:///android_asset/www/default/worklight/cordova.js:1063

Both my laptop and Mobile are connected to same wifi network 我的笔记本电脑和移动设备都连接到相同的wifi网络

Your server is likely set to "localhost". 您的服务器可能设置为“本地主机”。

  1. Open the Servers view in Eclipse 在Eclipse中打开“服务器”视图
  2. Double-click on "MobileFirst Development Server" 双击“ 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) 将主机值更改为计算机的IP地址(如果您有多个IP地址,请确保使用正确的IP地址)
  4. Re-start the server (should happen automatically after saving your changes in step 3) 重新启动服务器(在步骤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) 通过右键单击应用程序文件夹>运行方式>在MobileFirst Development Server上运行来重新构建应用程序(这确保设置的IP地址将传播到项目的wlclient.properties文件中)
  6. Delete the application from the device 从设备上删除应用程序
  7. Re-install the newly generated application (from step 5) 重新安装新生成的应用程序(从步骤5)

Verify that the application is now able to connect to the MFP Server. 验证应用程序现在能够连接到MFP Server。

Did you check wlclient.properties file in native android folder?? 您是否检查了原生android文件夹中的wlclient.properties文件? In that file check wlserverhost and wlserver port. 在该文件中,检查wlserverhost和wlserver端口。 Before that if you deploy your app to any remote server that ip address and port number should configured for android environment. 在此之前,如果将应用程序部署到任何远程服务器,则应为android环境配置ip地址和端口号。 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.. 通过取消选中“构建应用程序以与其他移动优先服务器一起使用...”来更改该IP地址和端口号...将应用程序重新构建到本地移动优先服务器。

Para eclipse luna 4.4.0 and WORKLIGHT 6.3 月蚀月球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!!! 礼炮!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM