Nativescript + Angular -> Error: Can't resolve all parameters for ApplicationModule: (?)

Nativescript + Angular -> Error: Can't resolve all parameters for ApplicationModule: (?)

所以我按照我一直在做的 NS 更新说明升级了我的 nativescript+angular 应用程序。然而这一次,在构建应用程序之后,当我尝试打开它时抛出以下错误

System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{pt.XX.YY/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Can't resolve all parameters for ApplicationModule: (?).
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{pt.XX.YY/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Can't resolve all parameters for ApplicationModule: (?).
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3430)
System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614)
System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86)
System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:112)
System.err:     at android.os.Looper.loop(Looper.java:216)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7625)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Can't resolve all parameters for ApplicationModule: (?).
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err:     at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:24)
System.err:     at android.app.Activity.performCreate(Activity.java:7458)
System.err:     at android.app.Activity.performCreate(Activity.java:7448)
System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1286)
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3409)
System.err:     ... 11 more

更多信息,下面是我的 package.json:

{
    "nativescript": {
      "id": "pt.XX.YY",
      "tns-ios": {
        "version": "6.5.0-2020-05-05-100821-02"
      },
      "tns-android": {
        "version": "6.5.1"
      }
    },
    "description": "NativeScript Application",
    "license": "SEE LICENSE IN <your-license-filename>",
    "repository": "<fill-your-repository-here>",
    "dependencies": {
      "@angular/animations": "~9.0.0",
      "@angular/common": "~9.0.0",
      "@angular/compiler": "~9.0.0",
      "@angular/core": "~9.0.0",
      "@angular/forms": "~9.0.0",
      "@angular/platform-browser": "~9.0.0",
      "@angular/platform-browser-dynamic": "~9.0.0",
      "@angular/router": "~9.0.0",
      "@nativescript/angular": "https://github.com/nstudio/ns-ng/blob/master/nativescript-angular-9.0.0.tgz?raw=true",
      "@nativescript/core": "6.6.0-next-2020-05-08-112112-01",
      "@nativescript/theme": "^2.3.3",
      "@nstudio/nativescript-checkbox": "^1.0.0",
      "nativescript-angular": "^8.21.0",
      "nativescript-feedback": "^1.3.12",
      "nativescript-lottie": "^4.0.1",
      "nativescript-material-floatingactionbutton": "^3.2.8",
      "nativescript-material-textfield": "^3.2.8",
      "nativescript-ngx-shadow": "^6.5.0",
      "nativescript-plugin-firebase": "^10.5.2",
      "nativescript-statusbar": "^5.0.0",
      "nativescript-ui-calendar": "^6.1.0",
      "nativescript-ui-listview": "^8.2.0",
      "reflect-metadata": "~0.1.12",
      "rxjs": "^6.4.0",
      "tns-core-modules": "^6.5.8",
      "zone.js": "~0.10.2"
    },
    "devDependencies": {
      "@angular/compiler-cli": "~9.0.0",
      "@ngtools/webpack": "~9.0.0",
      "nativescript-dev-webpack": "^1.5.1",
      "typescript": "~3.6.4"
    },
    "gitHead": "e9af7b54b243e55ef28e4610c4ef8c83837d86c0",
    "readme": "NativeScript Application"
  }

此外,如果需要,我的 NgModule 导入:

@NgModule({
    bootstrap: [
        AppComponent
    ],
    imports: [
        NativeScriptModule,
        NativeScriptFormsModule,
        NativeScriptRouterModule,
        NativeScriptMaterialTextFieldModule,
        NativeScriptUIListViewModule,
        NativeScriptUICalendarModule,
        AppRoutingModule,
        TNSCheckBoxModule,
        NativeScriptStatusBarModule,
        NgShadowModule
    ],

下面也是我的 tsconfig,我猜它有 Ivy“修复”:

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "downlevelIteration": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "noEmitHelpers": true,
    "noEmitOnError": true,
    "skipLibCheck": true,
    "lib": [
      "es2017",
      "es6",
      "dom",
      "es2015.iterable"
    ],
    "baseUrl": ".",
    "paths": {
      "~/*": [
        "app/*"
      ],
      "*": [
        "./node_modules/*"
      ]
    }
  },
  "angularCompilerOptions": {
    "enableIvy": false
  },
  "includes": [
    "references.d.ts"
  ],
  "files": [
    "./app/main.ts"
  ],
  "exclude": [
    "node_modules",
    "platforms",
    "**/*.aot",
    "e2e"
  ]
}

有什么想法吗?如果你们需要更多信息,请告诉我。

谢谢

好吧,不知何故 运行 标志 --env.aot 解决了问题。可能会帮助某人 :)