hypery2k / nativescript-fabric

Handling App URLs in nativescript apps
MIT License
30 stars 14 forks source link

TypeError: Cannot read property 'init' of undefined - Angular #133

Closed dwsolutions closed 6 years ago

dwsolutions commented 6 years ago

Issue

Hi guys!

I would like to use Crashlytics. I followed the instructions @ https://www.npmjs.com/package/nativescript-fabric/v/2.0.2 but when I tried to run the application on android device I got the following error:

_System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: System.err: Error calling module function System.err: Error calling module function System.err: Error calling module function System.err: Error calling module function System.err: TypeError: Cannot read property 'init' of undefined System.err: File: "file:///data/data//files/app/tns_modules/nativescript-fabric/app/app.module.js, line: 6, column: 10 System.err: StackTrace: System.err: Frame: function:'', file:'file:///data/data//files/app/tns_modules/nativescript-fabric/app/app.module.js', line: 6, column: 11 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: Frame: function:'', file:'file:///data/data//files/app/tnsmodules/nativescript-fabric/angular.js', line: 3, column: 20 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: Frame: function:'', file:'file:///data/data//files/app/app.module.js', line: 44, column: 17 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: Frame: function:'', file:'file:///data/data//files/app/main.js', line: 5, column: 20 System.err: Frame: function:'require', file:'', line: 1, column: 266

I tried to remove android platform (also deleted the hooks and node_modules directories) but the issue is the same. I'm using angular.

Here is my package.json:

{ ... "dependencies": { "@angular/animations": "~5.2.6", "@angular/common": "~5.2.6", "@angular/compiler": "~5.2.6", "@angular/core": "~5.2.6", "@angular/forms": "~5.2.6", "@angular/http": "~5.2.6", "@angular/platform-browser": "~5.2.6", "@angular/platform-browser-dynamic": "~5.2.0", "@angular/router": "~5.2.6", "@teammaestro/nativescript-svg": "^1.0.1", "@types/lodash": "^4.14.104", "faker": "^4.1.0", "lodash": "^4.17.5", "moment": "^2.20.1", "nativescript": "^4.0.2", "nativescript-accordion": "^5.0.4", "nativescript-angular": "^5.2.0", "nativescript-background-http": "^3.2.0", "nativescript-bottom-navigation": "1.1.3", "nativescript-cardview": "2.0.5", "nativescript-checkbox": "3.0.3", "nativescript-drop-down": "^3.2.2", "nativescript-fabric": "^2.0.2-bugfix-build-and-release-6", "nativescript-floatingactionbutton": "^4.1.3", "nativescript-imagepicker": "^4.0.1", "nativescript-loading-indicator": "^2.4.0", "nativescript-localstorage": "^1.1.5", "nativescript-material-icons": "^1.0.3", "nativescript-ng-shadow": "2.1.0", "nativescript-ng2-fonticon": "^1.3.4", "nativescript-popup": "^1.4.0", "nativescript-pro-ui": "^3.4.0", "nativescript-pulltorefresh": "^2.1.0", "nativescript-screen-orientation": "^2.0.0", "nativescript-social-share": "^1.5.0", "nativescript-speech-recognition": "^1.3.1", "nativescript-swiss-army-knife": "3.0.0", "nativescript-theme-core": "1.0.4", "nativescript-toast": "^1.4.6", "nativescript-ui-calendar": "^3.6.0", "npm": "^5.10.0", "reflect-metadata": "0.1.12", "rxjs": "^5.5.6", "tns": "^0.1.0", "tns-core-modules": "^4.0.0", "zone.js": "^0.8.20" }, "devDependencies": { "@angular/compiler-cli": "~5.2.6", "@ngtools/webpack": "~1.10.1", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "codelyzer": "4.1.0", "copy-webpack-plugin": "~4.4.2", "css-loader": "^0.28.10", "extract-text-webpack-plugin": "~3.0.2", "lazy": "1.0.11", "nativescript-dev-sass": "1.3.5", "nativescript-dev-typescript": "^0.6.0", "nativescript-dev-webpack": "^0.9.2", "nativescript-worker-loader": "~0.8.1", "node-sass": "4.7.2", "raw-loader": "~0.5.1", "resolve-url-loader": "~2.2.1", "sass-loader": "~6.0.6", "tslint": "5.9.1", "typescript": "~2.7.2", "uglifyjs-webpack-plugin": "~1.2.2", "webpack": "~3.10.0", "webpack-bundle-analyzer": "^2.11.0", "webpack-cli": "^2.0.9", "webpack-sources": "~1.1.0" } }

And here is the init in my app.module.ts:

import {FabricModule} from 'nativescript-fabric/angular';

@NgModule({ bootstrap: [ AppComponent ], imports: [ ... FabricModule.forRoot() ], schemas: [ NO_ERRORS_SCHEMA ] ... })

Could you help me please to resolve this issue?

Thank you very much! Attila

Environment

NativeScript version: 4.0.2 Plugin version: 2.0.2 NodeJS and NPM version: nodejs@v6.14.2; npm@6.1.0 Platform(s) running: android TNS (Android) version: 4.0.1

hypery2k commented 6 years ago

could you please use the stable "2.0.2" not any next version?

dwsolutions commented 6 years ago

Yep, I've tried it before but I got the same issue, that's why I added the next version.

dwsolutions commented 6 years ago

Hi!

I've updated again everything to the newest version (tns, npm etc) in my project and it's working now.

hypery2k commented 6 years ago

great