我安装在 Android OS 6+(Marshmallow 及更高版本)上的 Cordova 应用程序最近在安装 Chrome (62.0.3202.84) 时“崩溃”了——我的意思是随机 Cordova 插件停止正确加载。链接的网络资产随机丢失,某些插件“已定义”,有时 Cordova 本身无法加载。
这很奇怪——我几乎尝试了所有版本的 Cordova-Android 和 Cordova CLI 版本。这是一个 Ionic v1 应用程序。
有没有人对 Chrome (62.0.3202.84) 和他们的 Cordova 应用程序感到陌生?这是一些信息:
包.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"
],
配置.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>
项目属性:
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
离子信息:
`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
我试过cordova-android
版本:
5.0.0 - 6.4.0(以及一些夜间 6.5.xx 版本)。
再次,关键错误是 Cordova 的 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
这是很多信息,但如果需要,我可以尝试提供更多信息。所有这些都可以在 62 以下的任何版本的 Chrome-Android 上很好地编译。任何帮助都将受到高度重视。