0

My Cordova app installed on Android OS 6+ (Marshmallow and higher) recently 'broke'when installing Chrome (62.0.3202.84) -- and by this, I mean that random Cordova plugins stop loading properly. Web assets linked are randomly missing, some plugins are 'already defined', and sometimes Cordova itself doesn't load.

It is bizarre -- I've tried just about every version of Cordova-Android and Cordova CLI version possible. It is an Ionic v1 app.

Has anyone experienced strange-ness with Chrome (62.0.3202.84) and their Cordova app? Here is some info:

package.json:

"cordova-plugin-splashscreen@4.0.1",
    "cordova-plugin-crypt-file@1.1.1",
    "ionic-plugin-keyboard@2.2.1",
    "cordova-plugin-touchid",
    "cordova-plugin-google-analytics@1.7.4",
    "cordova-plugin-network-information@1.3.1",
    "cordova-plugin-market",
    "cordova-plugin-printer@0.7.2",
    "cordova-plugin-keepe-cardio",
    "cordova-plugin-file@4.3.1",
    "cordova-plugin-privacyscreen@0.3.1",
    "cordova-plugin-badge@0.7.2",
    "cordova-plugin-fcm@~2.1.1",
    "cordova-plugin-secure-storage@2.6.3",
    "cordova-custom-config --fetch"
  ],
  "cordovaPlatforms": [
    "ios@4.3",
    "android@6.2.3"
  ],

config.xml:

<widget android-versionCode="XXXXXXXXX" id="com.xxxxxx.zzzzz" ios-CFBundleVersion="2.3.0" version="2.3.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">



<preference name="AndroidPersistentFileLocation" value="Compatibility"/>
  <preference name="detect-data-types" value="false"/>
  <preference name="orientation" value="portrait"/>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="android-minSdkVersion" value="21"/>
  <preference name="android-targetSdkVersion" value="25" />
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreenDelay" value="4000"/>
  <preference name="ShowSplashScreenSpinner" value="false"/>
  <preference name="orientation" value="portrait"/>
  <preference name="FadeSplashScreen" value="false"/>
  <preference name="AutoHideSplashScreen" value="true"/>
  <preference name="iosPersistentFileLocation" value="Library"/>
  <preference name="AndroidPersistentFileLocation" value="Compatibility"/>
  <preference name="Fullscreen" value="false"/>
  <preference name="StatusBarOverlaysWebView" value="true"/>
  <preference name="StatusBarBackgroundColor" value="#002740"/>
  <preference name="AndroidPersistentFileLocation" value="Compatibility"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="StatusBarStyle" value="BlackTranslucent"/>
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
  <platform name="ios">
    <preference name="deployment-target" value="9.0"/>
    <preference name="KeychainAccessibility" value="WhenUnlockedThisDeviceOnly"/>
    <icon src="resources/ios/icon/icon.png" width="57" height="57"/>
    <icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
    <icon src="resources/ios/icon/icon-40.png" width="40" height="40"/>
    <icon src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
    <icon src="resources/ios/icon/icon-40@3x.png" width="120" height="120"/>
    <icon src="resources/ios/icon/icon-50.png" width="50" height="50"/>
    <icon src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
    <icon src="resources/ios/icon/icon-60.png" width="60" height="60"/>
    <icon src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
    <icon src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
    <icon src="resources/ios/icon/icon-72.png" width="72" height="72"/>
    <icon src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
    <icon src="resources/ios/icon/icon-76.png" width="76" height="76"/>
    <icon src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
    <icon src="resources/ios/icon/icon-83.5@2x.png" width="167" height="167"/>
    <icon src="resources/ios/icon/icon-small.png" width="29" height="29"/>
    <icon src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
    <icon src="resources/ios/icon/icon-small@3x.png" width="87" height="87"/>
    <splash src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/>
    <splash src="resources/ios/splash/Default-736h.png" width="1242" height="2208"/>
    <splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" height="2732"/>
    <splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="resources/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/>
  </platform>
  <platform name="android">
    <preference name="android-manifest/application/@android:allowBackup" value="false"/>
    <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
    <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
    <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
    <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
    <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
    <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
  </platform>
  <icon src="resources/android/icon/drawable-xhdpi-icon.png"/>
</widget>

project.properties:

target=android-25
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:appcompat-v7:23.4.0
cordova.system.library.2=com.google.android.gms:play-services-analytics:11.0.1
cordova.system.library.3=com.google.firebase:firebase-core:11.0.1
cordova.system.library.4=com.google.firebase:firebase-messaging:11.0.1
cordova.gradle.include.1=cordova-plugin-badge/XXXXXXXX-badge.gradle

ionic-info:

`Cordova CLI: 6.5.0
Gulp version:  CLI version 3.9.0
Gulp local:
Ionic CLI Version: 1.7.12
Ionic App Lib Version: 0.6.5
ios-deploy version: 1.8.4
ios-sim version: 5.0.4
OS: Mac OS X El Capitan
Node Version: v6.11.5
Xcode version: Xcode 9.1 Build version 9B55`

Sample Stack Trace in Chrome Dev Tools:

`ng-cordova.js Failed to load resource: the server responded with a status of 404 (Not Found)
cordova.js:79 Uncaught module cordova-plugin-file.DirectoryEntry already defined
cordova.js:79 Uncaught module cordova-plugin-file.FileWriter already defined
cordova.js:79 Uncaught module cordova-plugin-file.Metadata already defined
cordova.js:79 Uncaught module cordova-plugin-network-information.network already defined
cordova.js:1469 Uncaught Error: Module cordova-plugin-file.DirectoryReader does not exist.
    at addEntry (cordova.js:1469)
    at Object.exports.clobbers (cordova.js:1479)
    at onScriptLoadingComplete (cordova.js:1893)
    at scriptLoadedCallback (cordova.js:1926)
    at HTMLScriptElement.<anonymous> (cordova.js:1880)
app.js:7574 Creating database
app.js:7592 createSecureStorage called
app.js:5574 reset access and refreshtoken
vendor.js:121760 WebSocket connection to 'ws://localhost:9485/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
connect @ vendor.js:121760
favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found)
3vendor.js:121760 WebSocket connection to 'ws://localhost:9485/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
connect @ vendor.js:121760
cordova.js:1223 deviceready has not fired after 5 seconds.
cordova.js:1216 Channel not fired: onPluginsReady
cordova.js:1216 Channel not fired: onCordovaReady
24vendor.js:121760 WebSocket connection to 'ws://localhost:9485/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
connect @ vendor.js:121760

I have tried cordova-android versions:

5.0.0 - 6.4.0 (And some nightly 6.5.xx versions).

The key error is, again, the failure of Cordova's Device Ready to fire:

cordova.js:1223 deviceready has not fired after 5 seconds.
cordova.js:1216 Channel not fired: onPluginsReady
cordova.js:1216 Channel not fired: onCordovaReady

This is a lot of info, but I can try to provide more if needed. All of this compiles well on any version of Chrome-Android below 62. Any help would be superbly valued.

1 Answers1

0

So I found out sort of a fix..

I ended up adding Crosswalk. Yeah, yeah, that was the very first thing I tried. I managed to get a successful build with Cordova-Android 6.2.3, Node 6.10.3, Ionic CLI 2.1.7, Cordova 6.5.0.. but the build always crashed upon start.

I ended up with these commands, and it worked:

ionic state reset && sh bin/copyGradle && ionic build android --verbose
cordova plugin add cordova-plugin-crosswalk-webview
ionic build android --verbose

I can reproduce this successful build. If I have time, perhaps I could fork Crosswalk and see if I could keep it maintained. Maybe I'll switch to Yarn so I can have a cached copy of the Crosswalk versions I need.. since I've noticed that those servers have been on/offline sporadically as of late.

If you're fighting the Ionic 1 battle still, hang in there.