App not running in versions of Android < 7.0, probable es6 error?

App not running in versions of Android < 7.0, probable es6 error?

by Grayson Bartlet -
Number of replies: 2

Hello,

We build the mobile app using phonegap. It runs fine in iOS and on Android 7 or 8 devices. But when we try to run it on an Android OS below 7 (we've tried 4.4, 5.0, and 6.0), it hangs with a white screen on boot. Running it in the Android emulator, these messages always show up in the log slightly before that:

10-26 23:05:48.603 8270-8270/com.ilsc.ilscmobile D/SystemWebChromeClient: file:///android_asset/www/build/vendor.js: Line 86918 : Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
10-26 23:05:48.603 8270-8270/com.ilsc.ilscmobile I/chromium: [INFO:CONSOLE(86918)] "Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode", source: file:///android_asset/www/build/vendor.js (86918)
10-26 23:05:49.175 8270-8270/com.ilsc.ilscmobile D/SystemWebChromeClient: file:///android_asset/www/build/main.js: Line 1 : Uncaught ReferenceError: webpackJsonp is not defined
10-26 23:05:49.175 8270-8270/com.ilsc.ilscmobile I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: webpackJsonp is not defined", source: file:///android_asset/www/build/main.js (1)
Line 86918 of vendor.js is:
let d = __webpack_require__(1712)('electron-windows-notifications:tile-notification')
If I fix that occurrence by adding a "use strict"; then it starts complaining about the equals sign (for the default parameter) a few more lines below:
getWindowsVersion (version = os.release()) {

This leads me to believe that it's just older Android versions not being able to handle ES6 features. I was under the impression that the 3.5 mobile app was compatible with all versions of Android 4.4 and above. Is this stuff supposed to be getting transpiled away?

I've tried node 8.10.0, 8.12.0, and 9.11.2. I've tried Ionic 3.20.0 and 4.2.1. I've tried using both JIT and AOT compilation. I've stuck with cordova 8.1.2 and gulp cli 3.9.1. I'm building in Windows 10 (which might be relevant since the section of vendor.js causing trouble appears to be windows-related). I'm assuming the problem is somewhere in my build environment, as I haven't made any meaningful changes to config.xml.

Any advice on what I can try? Any more information I can provide?

Edit: yeah the problematic parts appear to be from the electron-windows-notifications module listed under "optionalDependencies" in package.json. Do I need this?
Average of ratings: -
In reply to Grayson Bartlet

Re: App not running in versions of Android < 7.0, probable es6 error?

by Grayson Bartlet -

Building in Linux fixed this for me. Unfortunately a linux build takes like 5x longer than a Windows build for me, so I'd like to figure out how to resolve this in Windows. Can I do without the "electron-windows-notifications" module?

In reply to Grayson Bartlet

Re: App not running in versions of Android < 7.0, probable es6 error?

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Grayson,

sorry for the delay in answering. The electron-windows-notifications library is only required for the Windows desktop app, so you can remove it. Actually, we'll remove it from package.json in the next release because it causes problems with the Android & iOS builds. It's a shame that package.json doesn't let us define that a library should only be installed in a certain OS, it needs to be specified by the library itself.

Cheers,

Dani