IBM工作灯 - 无法加载的index.html在道场的应用程序 [英] IBM Worklight - Unable to load index.html in a Dojo app
问题描述
我已经创建的样本Wokrlight项目与Dojo库(默认模板项目)。
应用程序的Android版本运行正常,在Android模拟器显示的index.html的内容。但是当我运行设备中的相同的应用程序,它首先表明IBM开机画面,然后出现以下错误:
应用程序错误的连接服务器失败。 (文件:///data/data/com.HelloWorklight/files/www/default/index.html)
下面是我遵循的步骤。
- 创建新的混合应用工作灯项目HelloWorklight与应用程序名称为HelloWorklight。
- 在使用配置JavaScript库新增Dojo库,并点击完成 ==这造成在Eclipse中命名为HelloWorklight项目。
- 现在,我加入Android手机和平板电脑的应用descriptor.xml(使用设计选项卡只) ==现在我可以看到Android的子文件夹内的应用程序\ HelloWorklight \
- 然后我用鼠标右键点击机器人(从APPS \ HelloWorklight),然后选择运行方式>机器人工作室项目 ==这创造了一个以上的方案(Android项目)的日食为HelloWorklightHelloWorklightAndroid
- 现在,我右键点击HelloWorklightHelloWorklightAndroid,然后选择运行方式>Android应用程序 ==这将打开AVD / Android模拟器使用默认设备,我可以看到Android模拟器屏幕上的index.html的内容。
- 现在,当我的测试Android设备连接到系统的运行方式..选项promts我选择模拟器/设备。当我选择它的设备上安装的设备的应用程序,并运行应用程序。 ==在这里,我看到的第一台IBM闪屏上面的错误。
注意
- 在我试图运行的应用程序使用.apk文件导出。果然 可以显示相同的错误信息。当我检查的.apk文件,它拥有所有 要求内容(HTML,JS和CSS文件)。即使是位置 文件 文件: ///数据/数据/ com.HelloWorklight /文件/ WWW /默认/ index.html的
- 应用程序即使工作灯开发运行在模拟器 服务器停止
您第4步是不需要的和不正确的:
-
您应该选择机器人工作室项目只有当你真正拥有的 Android的工作室在计算机中安装,如果你真的打算使用它。否则,它会失败:
无法运行Android工作室:在指定的Android工作室的位置 窗口 - > preferences->工作灯
-
选择也无妨,是不是产生了Android项目;加入了Android的环境,您的申请后,正在的由工作灯工作室自动生成的Android项目的你。
我已按照工作灯6.1.0的步骤,并在这两个AVD和设备测试,无法生育。
请尝试以下步骤,并告诉我结果:
- 在Eclipse中,preSS <大骨节病> CTRL 骨节病> + <大骨节病> 3 (或<大骨节病> CMD 骨节病> + <大骨节病> 3 骨节病>如果在Mac)并添加
Dojo库的要求
视图 - preSS的玩般的按钮来禁用它(它是默认启用)
- 重新构建和部署
- 在设备重新运行和测试
- 在熟悉道场的工作灯:<一href="http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/topic/com.ibm.worklight.dev.doc/wl_studio_tools/topics/cdojolibprjsetupwl.html"相对=nofollow>使用Dojo库项目,供应道场资源 工作
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.
- Create New Hybrid Application Worklight Project "HelloWorklight" with Application Name as "HelloWorklight".
- Added Dojo Library using "Configure Javascript Library" and click on "finish" == This created a Project Named "HelloWorklight" in Eclipse.
- Now I added Android phones and tablets in "application-descriptor.xml" (Using Design Tab Only) == Now I can See "android" SubFolder inside "Apps\HelloWorklight\"
- 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"
- 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.
- 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
- 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
- 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:
- In Eclipse, press ctrl+3 (or cmd+3 if in Mac) and add the
Dojo Library Requests
view - Press the "play"-like button to disable it (it is enabled by default)
- Re-build and deploy
- Re-run and test in the device
- Familiarize yourself with Dojo in Worklight: Working with the Dojo Library Project that serves Dojo resources
这篇关于IBM工作灯 - 无法加载的index.html在道场的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!