Worklight 6.1 Android Applicaiton renders all views with no widgets

前端 未结 1 665
长情又很酷
长情又很酷 2021-01-24 16:51

I\'ve developed a hybrid application using Worklight 6.1 + Dojo 1.8. The application tests out fine using Chrome \"Common & Android\". When I deploy the device to my Nexus

相关标签:
1条回答
  • 2021-01-24 17:02

    Worklight 6.1 uses Dojo v1.9.1-20130926, not v1.8.
    You can verify this in the dojoLib created for you when adding Dojo to a Worklight project. There is a version.txt file.

    There is one relevant error from the LogCat: scriptError dojo.js:21
    Most relevant past questions:

    • Worklight core-web-layer.js errors
    • IBM Worklight 6.0 - Unable to run sample hybrid worklight app using dojo toolkit for android environment on avd?

    I do not know if the 1.8 was a typo or not, but I would suggest to start afresh with a new Worklight project, following my example below. If this is now working, I suggest to continue onwards from there.


    This is what I've done. Let me know if you're doing anything else in specific:

    1. Created a new Worklight project and application; used the wizard to add the Dojo library
    2. Added the iPhone environment (while you've added Android, this is not environment-specific)
    3. Added the following Dojo widgets: Heading, Button, TextBox, Slider, Carousel, CarouselItem...

      In common\js\main.js, dojoInit() is auto-updated with the required modules in the require function:

      function dojoInit() {
        require([ "dojo/ready", "dojo/parser", "dojox/mobile", "dojo/dom", 
        "dijit/registry", "dojox/mobile/ScrollableView",
        "dojox/mobile/Button", "dojox/mobile/Heading", "dojox/mobile/TextBox",   
        "dojox/mobile/Carousel", "dojox/mobile/CarouselItem", "dojox/mobile/SearchBox", 
        "dojox/mobile/Slider"], >
      
       function(ready) {
            ready(function() {
            });
        });
      }
      
    4. Run As > Run on Worklight Development Server
    5. Preview in Worklight Console's MBS
    6. Open in Xcode
    7. Run on iOS Simulator and/or device

    In both the MBS and simulator/device, I see the same:

    MBS:
    enter image description here

    iOS Simulator/device:
    enter image description here

    Now if I go to the Dojo Library Requests view and uncheck Provide Missing Dojo Resources and re-run in Xcode, the graphics will then not load. If I re-check the option and re-run in Xcode, the graphics then load again.

    Missing graphics:
    enter image description here

    To correct this I needed to re-build the project in Eclipse.
    Why?

    When building with Provide Missing Dojo Resources checked, you will find the following in the HEAD of the generated HTML: <script data-dojo-config="isDebug: false, async: true, parseOnLoad: true, mblHideAddressBar: false" src=http://some-ip-address-and-path/dojo/dojo.js" type="text/javascript"></script>

    This src URL tells the application to get all Dojo resources from the dojoLib library in the server.
    When unchecking Provide Missing Dojo Resources and re-building the project in Eclipse, the src URL changes to dojo/dojo.js, meaning all resources will be taken from whatever is included in the Dojo library inside the application.

    0 讨论(0)
提交回复
热议问题