IBM工作灯 - 无法加载的index.html在道场的应用程序 [英] IBM Worklight - Unable to load index.html in a Dojo app

查看:328
本文介绍了IBM工作灯 - 无法加载的index.html在道场的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建的样本Wokrlight项目与Dojo库(默认模板项目)。

应用程序的Andr​​oid版本运行正常,在Android模拟器显示的index.html的内容。但是当我运行设备中的相同的应用程序,它首先表明IBM开机画面,然后出现以下错误:

  

应用程序错误的连接服务器失败。   (文件:///data/data/com.HelloWorklight/files/www/default/index.html)

下面是我遵循的步骤。

  1. 创建新的混合应用工作灯项目HelloWorklight与应用程序名称为HelloWorklight。
  2. 在使用配置JavaScript库新增Dojo库,并点击完成 ==这造成在Eclipse中命名为HelloWorklight项目。
  3. 现在,我加入Android手机和平板电脑的应用descriptor.xml(使用设计选项卡只) ==现在我可以看到Android的子文件夹内的应用程序\ HelloWorklight \
  4. 然后我用鼠标右键点击机器人(从APPS \ HelloWorklight),然后选择运行方式>机器人工作室项目 ==这创造了一个以上的方案(Android项目)的日食为HelloWorklightHelloWorklightAndroid
  5. 现在,我右键点击HelloWorklightHelloWorklightAndroid,然后选择运行方式>Android应用程序 ==这将打开AVD / Android模拟器使用默认设备,我可以看到Android模拟器屏幕上的index.html的内容。
  6. 现在,当我的测试Android设备连接到系统的运行方式..选项promts我选择模拟器/设备。当我选择它的设备上安装的设备的应用程序,并运行应用程序。 ==在这里,我看到的第一台IBM闪屏上面的错误。

注意

  1. 在我试图运行的应用程序使用.apk文件导出。果然 可以显示相同的错误信息。当我检查的.apk文件,它拥有所有 要求内容(HTML,JS和CSS文件)。即使是位置 文件 文件: ///数据/数据​​/ com.HelloWorklight /文件/ WWW /默认/ index.html的
  2. 应用程序即使工作灯开发运行在模拟器     服务器停止
解决方案

您第4步是不需要的和不正确的:

  • 您应该选择机器人工作室项目只有当你真正拥有的 Android的工作室在计算机中安装,如果​​你真的打算使用它。否则,它会失败:

      

    无法运行Android工作室:在指定的Andr​​oid工作室的位置   窗口 - > preferences->工作灯

  • 选择也无妨,是不是产生了Android项目;加入了Android的环境,您的申请后,正在的由工作灯工作室自动生成的Andr​​oid项目的你。

我已按照工作灯6.1.0的步骤,并在这两个AVD和设备测试,无法生育。

请尝试以下步骤,并告诉我结果:

  1. 在Eclipse中,preSS <大骨节病> CTRL + <大骨节病> 3 (或<大骨节病> CMD + <大骨节病> 3 如果在Mac)并添加 Dojo库的要求视图
  2. preSS的玩般的按钮来禁用它(它是默认启用)
  3. 重新构建和部署
  4. 在设备重新运行和测试
  5. 在熟悉道场的工作灯:<一href="http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/topic/com.ibm.worklight.dev.doc/wl_studio_tools/topics/cdojolibprjsetupwl.html"相对=nofollow>使用Dojo库项目,供应道场资源
  6. 工作

I have created sample Wokrlight Project with Dojo library (default template project).

The Android version of app runs fine in the Android Emulator showing the content of index.html. But When I run the same app in a device, it first shows IBM splash image and then the following error:

Application Error The Connection to the server was unsuccessful. (file:///data/data/com.HelloWorklight/files/www/default/index.html)

Here are the steps I followed.

  1. Create New Hybrid Application Worklight Project "HelloWorklight" with Application Name as "HelloWorklight".
  2. Added Dojo Library using "Configure Javascript Library" and click on "finish" == This created a Project Named "HelloWorklight" in Eclipse.
  3. Now I added Android phones and tablets in "application-descriptor.xml" (Using Design Tab Only) == Now I can See "android" SubFolder inside "Apps\HelloWorklight\"
  4. Then I right-clicked on "android" ( from Apps\HelloWorklight ) and Then selected "Run As" > "Android Studio Project" == This created One more project (Android Project) in eclipse as "HelloWorklightHelloWorklightAndroid"
  5. Now I right-click on "HelloWorklightHelloWorklightAndroid" and select "Run As" > "Android Application" == This opens AVD / Android Emulator with default Device and I can see the index.html content on the Android Emulator screen.
  6. Now When My Test Android Device is connected to system, "Run As .." option promts me to select Emulator / Device. When I select Device It installs the app on Device and runs Application. == Here I see first IBM Splash Screen the the above error.

NOTE

  1. I tried running application using .apk exported. which turns out to be showing same error message. When I check the .apk file it has all contents required (html, js and css files). Even the location of file is file:///data/data/com.HelloWorklight/files/www/default/index.html
  2. The application runs on Emulator Even if Worklight Development Server is stopped

解决方案

Your step #4 is not needed and incorrect:

  • You should choose "Android Studio Project" only if you actually have Android Studio installed in your computer and if you actually intended on using it. Otherwise it will fail:

    Failed Running Android Studio: Specify location of Android Studio in Window->Preferences->Worklight

  • Choosing it anyway, is not what generates the Android project; After adding the Android environment to your application, the Android project is being auto-generated for you by Worklight Studio.

I have followed your steps in Worklight 6.1.0 and tested in both AVD and device, and could not reproduce.

Try the following steps and tell me the result:

  1. In Eclipse, press ctrl+3 (or cmd+3 if in Mac) and add the Dojo Library Requests view
  2. Press the "play"-like button to disable it (it is enabled by default)
  3. Re-build and deploy
  4. Re-run and test in the device
  5. Familiarize yourself with Dojo in Worklight: Working with the Dojo Library Project that serves Dojo resources

这篇关于IBM工作灯 - 无法加载的index.html在道场的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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