升级到Angular 12后,Ionic Android应用程序一直显示白色,错误:gog.getLocale不是函数

hpcdzsge  于 2022-12-09  发布在  Ionic
关注(0)|答案(1)|浏览(167)

我最近尝试在我的Ionic应用程序中将Angular 11升级到12。一切都很顺利,应用程序在浏览器中运行时没有任何错误。然而,当我尝试在Android手机上运行它时,在闪屏消失后,应用程序陷入了白色。
我尝试使用chrone://inspect工具,看看是否出现任何错误,结果显示:

我在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"
  },

谢谢你!

k7fdbhmy

k7fdbhmy1#

@编辑日期:2021年9月
作为一个临时的解决方案,避免调用getGlobalLocale()。将其添加到index.html

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

此处相同,从angular@12.1更新为@12.2。
同时尝试更新到^12.1

相关问题