升级到 Angular 12 后,Ionic Android 应用程序卡在白屏上。错误:goog.getLocale 不是函数

问题描述 投票:0回答:2

我最近尝试在我的 Ionic 应用程序中将 Angular 11 升级到 12。一切都很顺利,应用程序正在浏览器中运行,没有错误。 然而,当我尝试在 Android 手机上运行它时,启动画面消失后,应用程序卡在白屏中。

我尝试使用

chrone://inspect
工具,看看是否有任何错误,结果出现了:

enter image description here

我在 Android Logcat 上也遇到同样的错误:

E/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 15729 - Msg: ERROR TypeError: goog.getLocale is not a function

我尝试在启动屏幕上添加超时、更新库、删除node_modules并重新安装它们,但没有任何效果。我在网上找不到关于此错误的太多信息。

谁能告诉我这个错误是什么意思或者为什么应用程序卡在这里?如果我回到 Angular 11,效果会很好。

我的 package.json 看起来像这样:

"dependencies": {
    "@agm/core": "^3.0.0-beta.0",
    "@angular/common": "~12.2.3",
    "@angular/core": "~12.2.3",
    "@angular/forms": "~12.2.3",
    "@angular/platform-browser": "~12.2.3",
    "@angular/platform-browser-dynamic": "~12.2.3",
    "@angular/router": "~12.2.3",
    "@capacitor-community/background-geolocation": "^0.3.11",
    "@capacitor/android": "^2.4.6",
    "@capacitor/core": "^2.4.6",
    "@capacitor/ios": "^2.4.6",
    "@ionic-native/android-permissions": "^5.30.0",
    "@ionic-native/clipboard": "^5.31.1",
    "@ionic-native/core": "^5.30.0",
    "@ionic-native/device": "^5.31.1",
    "@ionic-native/diagnostic": "^5.32.1",
    "@ionic-native/insomnia": "^5.30.0",
    "@ionic-native/launch-navigator": "^5.30.0",
    "@ionic-native/location-accuracy": "^5.30.0",
    "@ionic-native/market": "^5.33.1",
    "@ionic-native/mobile-accessibility": "^5.36.0",
    "@ionic-native/splash-screen": "^5.30.0",
    "@ionic-native/status-bar": "^5.30.0",
    "@ionic/angular": "^5.6.14",
    "@ionic/pwa-elements": "^3.0.2",
    "@ngrx/effects": "^10.0.0",
    "@ngrx/entity": "^10.0.0",
    "@ngrx/schematics": "^10.0.0",
    "@ngrx/store": "^10.0.0",
    "@ngrx/store-devtools": "^10.0.0",
    "@ngx-translate/core": "^12.1.2",
    "@ngx-translate/http-loader": "^6.0.0",
    "agm-direction": "^0.8.9",
    "cordova-clipboard": "^1.3.0",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-android-permissions": "^1.1.2",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-insomnia": "^4.3.0",
    "cordova-plugin-market": "^1.2.0",
    "cordova-plugin-network-information": "git+https://github.com/apache/cordova-plugin-network-information.git",
    "cordova-plugin-request-location-accuracy": "^2.3.0",
    "cordova.plugins.diagnostic": "^6.0.3",
    "core-js": "^3.8.3",
    "moment": "^2.28.0",
    "ngx-signaturepad": "^0.0.9",
    "phonegap-plugin-mobile-accessibility": "^1.0.5",
    "rxjs": "^6.6.3",
    "tslib": "^2.0.1",
    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.5",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.2.3",
    "@angular/cli": "^12.2.3",
    "@angular/compiler": "~12.2.3",
    "@angular/compiler-cli": "~12.2.3",
    "@angular/language-service": "~12.2.3",
    "@babel/core": "^7.10.2",
    "@capacitor/cli": "2.4.6",
    "@ionic/angular-toolkit": "^4.0.0",
    "@storybook/addon-actions": "^5.3.19",
    "@storybook/addon-knobs": "^5.3.19",
    "@storybook/addon-links": "^5.3.19",
    "@storybook/addon-notes": "^5.3.19",
    "@storybook/addon-options": "^5.3.19",
    "@storybook/addons": "^5.3.19",
    "@storybook/angular": "^5.3.19",
    "@types/googlemaps": "3.39.12",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "agm-overlays": "^2.0.0",
    "babel-loader": "^8.1.0",
    "codelyzer": "^6.0.1",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^6.3.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "^7.0.0",
    "ts-node": "~7.0.0",
    "tslint": "~6.1.0",
    "typescript": "4.3.5"
  },

谢谢你!

android angular ionic-framework npm
2个回答
3
投票

@编辑09/2021

作为临时修复,避免调用

getGlobalLocale()
。 将其添加到您的index.html

<script>
  var ngI18nClosureMode = false;
</script>

此处同样从 [电子邮件受保护] 更新为 @12.2。

同时尝试更新到^12.1


0
投票

这对我有用

路径:web/src/polyfills.browser.ts

添加以下代码

import 'zone.js/dist/zone';

// @ts-ignore
if (typeof window.ngI18nClosureMode === 'undefined') {
   Object.defineProperty(window, 'ngI18nClosureMode', {value: false, writable: true});
}
© www.soinside.com 2019 - 2024. All rights reserved.