Worklight mobile app doesn't load dojo mobile widgets on android 4.x devices

508 views Asked by At

I'm working on a mobile app, using Worklight (Hybrid Application) with Dojo Mobile. It has 3 views with a List in each one that show some hardcoded data.

When I run it in the Mobile Browser Simulator it works ok (Both 'Preview as common resources' and 'Android' views). With all the Dojo widgets loaded.

When I run it on a physical android mobile it seems to work only on those with android version 2.x.x, but it doesn't on android version 4.x.x. It doesn't load the dojo mobile widgets. It shows the three views in one simple html page.

The messages that appears in the log are the following:

11-29 19:49:44.081: D/DemoApp(6088): wlclient init started
11-29 19:49:44.091: D/DemoApp(6088): Read cookies: null
11-29 19:49:44.091: D/DemoApp(6088): CookieMgr read cookies: {}
11-29 19:49:44.231: D/DemoApp(6088): before: app init onSuccess
11-29 19:49:44.252: D/DemoApp(6088): after: app init onSuccess
11-29 19:49:44.252: D/DemoApp(6088): added onPause event handler 
11-29 19:49:44.252: D/DemoApp(6088): wlclient init success
11-29 19:49:45.703: D/chromium(6088): Unknown chromium error: -6
11-29 19:49:45.703: D/chromium(6088): Unknown chromium error: -6
11-29 19:49:45.973: D/CordovaLog(6088): Error: scriptError
11-29 19:49:45.973: E/Web Console(6088): Error: scriptError at file:///data/data/com.DemoApp/files/www/default/dojo/dojo.js:21
11-29 19:49:45.983: D/CordovaLog(6088): Error: scriptError
11-29 19:49:45.983: E/Web Console(6088): Error: scriptError at file:///data/data/com.DemoApp/files/www/default/dojo/dojo.js:21
11-29 19:50:07.554: D/CordovaWebView(6088): The current URL is: file:///data/data/com.DemoApp/files/www/default/DemoApp.html
11-29 19:50:07.554: D/CordovaWebView(6088): The URL at item 0 is:file:///data/data/com.DemoApp/files/www/default/DemoApp.html

Looking for "dojo.js:21" error on google I've found some possible solutions:

  • Make sure to have all dojo required files under www folder...
  • Uncheck "Provide Library Resources" option from Dojo Library Request console before the project building...
  • Reeplace core-web-layer_ROOT.js and mobile-ui-layer_ROOT.js from www/dojo/nls/ with the ones in toolkit/dojo/dojo/nls
  • Trigger dojo parser manually...

But none of these solutions have worked.

I've tried to build the app with android api 8, 15 and 18. Always with the same results.

I was working with:

  • Worklight ver: 6.0.0.20130926-1933
  • Dojo Toolkit SDK 1.8.1 for Worklight
  • Android Development Toolkit ver: 22.3.0.v201310242005-887826

And recently I've upgraded Worklight with the latest release:

  • Worklight ver: 6.1.0.20131126-0630
  • Dojo Toolkit SDK 1.9.1 for Worklight
  • Android Development Toolkit ver: 22.3.0.v201310242005-887826

Any help would be very appreciated.

Thanks!!

1

There are 1 answers

0
Patrick Ruzand On BEST ANSWER

Per the discussion in the comments:

It may be due to some i18n issues, depending on the locale returned by the webview, which may change depending on the device, but also on the Android version.

You should check there's an nls bundle corresponding to the webview locale deployed with your app. For example, if locale is en-us, you should copy dojo/nls/core-web-layer_en-us.js into your app.