Cordova Android App - Works on Android 7,8,9; Fails on Android 4,5, and 6

This has been a monster of a headache trying to figure out what is going on.

I have an android app that I have been developing and maintaining. My latest test devices are on android 9 and bring up the app with no issues. Many of the files that I am currently having issues with have been part of this project when these OS's were in their prime in popularity.

In order to maintain a wide compatibility range, I am targeting to get this app running on android 5 through 9

Steps to debug

  1. I have taken to updating plugins that could be causing the issue
  2. Test on real hardware and emulation
  3. Replace let with var
  4. Added console logging to see full stack traces


  1. On Android 4,5,6 when it tries to load jquery-1.8.1.js it returns the error below causing the whole app to crash. The stack trace seems rather unhelpful.

Uncaught SyntaxError: Unexpected token =

Stack Trace

Stack Trace

  1. On Android 5,6

Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

I imagine that this is due to the OS's age. Not sure how to enable strict mode through the entire app or even if that is a good thing. For the time being I have replaced all let with var to get around the issue. Not my preferred solution, if you have a better one, please let me know.



vsCode Android Studio: (Not sure why one of them can do both) * 3.6.1 for Emulators running x86 * 3.4.0 to connect to my test device

Test Devices

  • Samsung Galaxy 9 - Android 9 - Works
  • HTC 10 - Android 8 - Works
  • HTC One - Android 6 - Fails
  • Raspberry Pi 2 - Android 5 - Still booting. lol :'(

Test Emulators

All using a hardware profile for a LGVK700 and running x86_64

  • Android 9 - Works
  • Android 8 - Works
  • Android 7 - Works
  • Android 6 - Fails
  • Android 5 - Fails
  • Android 4 - Fails

Setting Files

This is running on Cordova 8.1.2 (cordova-lib@8.1.1)


<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="28" />

Cordova plugins and platforms

$ cordova plugins
cordova-android-support-gradle-release 2.0.1 "cordova-android-support-gradle-release"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-appminimize 1.0.1 "AppMinimize"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-opener2 2.2.0 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-media-capture 3.0.2 "Capture"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-save-image 0.3.0 "SaveImage"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist" 4.2.2 "Launch Navigator"
$ cordova platforms
Installed platforms:
  android 8.1.0
  ios 5.0.1


I have verified that cordova should be supporting 4.4, 5 and 6

Android Requirements

Target Versions

Target Versions