0

Using Worklight 5.0.5, I have issues with previewing my app in the Mobile Browser Simulator.

Once my app is deployed and I preview it in the MBS, nothing is displayed.
This occurs with every old and new project I create. Does anyone have an idea ? I didn't change my config at all.

This is the preview URL used:

localhost:8080/_MobileBrowserSimulator/index.html?webpage=../apps/services/preview/TestHybridApp/ipad/1.0/&platform=ios.ipad

Right now all I can do is preview as common resource, which doesn't take into account the changes I did.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
user3241019
  • 811
  • 9
  • 20
  • Can you try with the latest version of Worklight, 6.1.0.1? – Idan Adar Mar 18 '14 at 15:04
  • Not for now I'm affraid, I looked into Worklight documentation and I think that this could be related to [Cordova plugin](http://pic.dhe.ibm.com/infocenter/wrklight/v5r0m6/index.jsp?topic=%2Fcom.ibm.rad.worklight.doc%2Ftopics%2Ftpreview_Cordovawl.html), I'll investigate – user3241019 Mar 18 '14 at 16:05
  • 1
    What do you see in the Chrome dev tools? any errors? Also note that Cordova plug-ins (which utilize native code), will not work in the MBS, which only previews web resources. You will need to test your plug-in in a device or simulator/emulator. – Idan Adar Mar 18 '14 at 16:58
  • Yes, I have 2 errors : **"Uncaught SyntaxError: Unexpected token < "** and **"Uncaught ReferenceError: OpenLayers is not defined (dojo.js : 15)"** – user3241019 Mar 24 '14 at 10:13
  • The one about OpenLayers does not matter, it's about the MBS and not your application. The first one is interesting, it should also tell you in which file and line the error resides... – Idan Adar Mar 24 '14 at 10:18
  • Yes, but it is a link I can't show you, it led to OpenLayer.js but the errors were removed with the operation done below. – user3241019 Mar 24 '14 at 10:35

1 Answers1

1

Did not encounter this in 5.0.5.x, but try the following:

  1. Delete the native folder
  2. Close Eclipse
  3. Locate your temp folder (Windows, OS X)
  4. Delete the wlBuildResources and wlPreview folders
  5. Open Eclipse
  6. Re-build

If you have custom native code in your native\ folder, be sure to back it up.
More here (although it was written about Worklight 6.x, should work in 5.x...): Worklight 6.1 - "All Build" fails and gives java.lang.NullPointerException

Community
  • 1
  • 1
Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • My MBS doesn't work anymore again, tried what you suggest without result. `[2014-06-13 09:17:19] Application 'X' deployed successfully with environment 'ipad'`. I don't have any idea, I just noticed that I don't have the *wlPreview* folder in Temp. – user3241019 Jun 13 '14 at 07:21
  • I can't preview my app in the MBS like the previous time, nothing is displayed. Can't even previews as common resource. – user3241019 Jun 13 '14 at 07:48
  • Did you close eclipse and delete the wlbuildrwsources folder? – Idan Adar Jun 13 '14 at 07:49
  • Ok I think I got it, opened up the console and I got this : `Uncaught ReferenceError: OpenLayers is not defined dojo.js:15` at the very start of the launching of the MBS. I'll try to reimport dojo. (yes I did all you suggested me the last time) – user3241019 Jun 13 '14 at 07:49
  • Nope, I tried to create a new project, but the dojo keeps failing at runtime with every new project (always the same error with OpenLayers) :( Do you have any idea (except update worklight) ? – user3241019 Jun 13 '14 at 12:49
  • OpenLayers is not relevant to your error. OpenLayers is used for displaying maps. Do you use maps? In addition, is this still obout Worklight 5.0.5? Upgrade. – Idan Adar Jun 13 '14 at 13:03
  • LOL. Just created an Android environment to give it a try. Both apps (iPad & Android) are now well displayed in their own environments. And the *"Preview as common resource"* appears now in the catalog. I'll try this with my previous project, thanks for the support – user3241019 Jun 13 '14 at 13:13