0

so I did upgrade my nativescript+angular app following the NS update instructions as I've been doing. However this time, after building the app, when I try to open it the below error is thrown

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

For more info, below is my 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"
  }

Also, in case it is needed, my NgModule imports:

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

Below is also my tsconfig which has the Ivy "fix" I guess:

{
  "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"
  ]
}

Any idea? If you guys need more info please just let me know.

Thank you

1 Answer 1

1

Well, somehow running with the flag --env.aot fixed the problem. Might help someone :)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.