Forum Stats

  • 3,815,479 Users
  • 2,259,036 Discussions
  • 7,893,119 Comments

Discussions

Issue with deploying to Windows phone 10

pleysje
pleysje Member Posts: 5
edited Nov 28, 2016 10:33AM in Oracle JET

I am trying to deploy an existing JET application to Windows phone 10 but I run into some errors.

The application was first made in JET v2.0.2 for the Android platform, it is currently in production at the client.

The client now wants ios and windows phone versions, so the application got migrated to JET 2.2.0 by following this guide.

After migrating the Android version still works like it is supposed to.

I went through the following steps to work on the windows phone version:

1) First I added the windows platform with cordova

cordova add platform windows

2) I changed the windows target version (guide)

<preference name="windows-target-version" value="10.0" />

3) I installed visual studio 2015 and all the needed components by following the cordova guide

4) I open the generated solution (.sln) file with visual studio 2015

open.png

5) I change the startup project to the Windows 10 universal app and change the run target to a windows phone 10 emulator

target.png

6) When running the application it gets deployed to the emulator, but as soon as it runs  crashes with the following error message

windows phone err.png

Unhandled exception at line 1533, column 13 in ms-appx-web://workspace/www/cordova.js

0x800a1391 - JavaScript runtime error: 'WinJS' is undefined

I found this stackoverflow post which handles the same problem, like suggested I checked my index.html to see if the WinJS library is referenced before cordova.js which is the case.

  <script type="text/javascript" src="/www/WinJS/js/base.js"></script>

  <script src="cordova.js"></script>

When looking at the project structure I noticed that index.html is in the "www" folder.

solution.png

index.html references to the WinJS file like "/www/WinJS/js/base.js" so I tried referencing without the /www/ prefix. After changing the reference link I get a new error

windows phone err 2.png

Unhandled exception at line 7, column 175 in ms-appx-web://psa.mpet.containerapp/www/js/libs/require/require.js

0x800a139e - JavaScript runtime error: Mismatched anonymous define() module: function (WinJS) {

It is unclear to me why I am getting this error and how I can solve it.

Thanks in advance for your help.

Tagged:

Answers

  • pleysje
    pleysje Member Posts: 5
    edited Nov 28, 2016 10:33AM

    Changing the order of the import tags appears to have solved the problem.

    Putting <script type="text/javascript" src="/www/WinJS/js/base.js"></script> before the import tag for requirejs solved the issue.