NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.21k stars 241 forks source link

ERROR TypeError: undefined is not an object (evaluating 'application.android.on') while tns run ios #1968

Closed LakshmiEvana closed 4 years ago

LakshmiEvana commented 5 years ago

Iam getting this below error while tns run ios.Android is working fine for me.

image

Here is my package.json { "nativescript": { "id": "com.dev.sample.test", "tns-android": { "version": "5.4.0" }, "tns-ios": { "version": "5.4.2" } }, "description": "NativeScript Application", "license": "SEE LICENSE IN ", "repository": "", "scripts": { "lint": "tslint \"src/*/.ts\"" }, "dependencies": { "@angular/animations": "~7.2.10", "@angular/common": "~7.2.10", "@angular/compiler": "~7.2.10", "@angular/core": "~7.2.10", "@angular/forms": "~7.2.10", "@angular/http": "~7.2.10", "@angular/platform-browser": "~7.2.10", "@angular/platform-browser-dynamic": "~7.2.0", "@angular/router": "~7.2.10", "@nstudio/nativescript-cardview": "^1.0.0", "@nstudio/nativescript-pulltorefresh": "^1.0.1", "nativescript-angular": "~7.2.3", "nativescript-checkbox": "^3.0.3", "nativescript-drop-down": "^5.0.0", "nativescript-exit": "^1.0.1", "nativescript-fancyalert": "^3.0.6", "nativescript-gif": "^4.0.2", "nativescript-loading-indicator": "^2.4.0", "nativescript-mediafilepicker": "^2.0.16", "nativescript-pdf-view": "^2.0.1", "nativescript-phone": "^1.4.0", "nativescript-plugin-firebase": "^8.3.2", "nativescript-snackbar": "^4.1.2", "nativescript-speech-recognition": "^1.4.1", "nativescript-sqlite": "^2.3.3", "nativescript-theme-core": "^1.0.6", "nativescript-toasts": "^1.0.3", "nativescript-ui-calendar": "^4.0.0", "nativescript-ui-sidedrawer": "~6.0.0", "nativescript-videoplayer": "^4.2.1", "reflect-metadata": "~0.1.13", "rxjs": "~6.4.0", "rxjs-compat": "^6.4.0", "tns-core-modules": "^5.2.2", "zone.js": "~0.9.0" }, "devDependencies": { "@angular/compiler-cli": "~7.2.0", "@nativescript/schematics": "~0.5.0", "@ngtools/webpack": "~7.2.0", "codelyzer": "~4.5.0", "nativescript-dev-sass": "^1.7.0", "nativescript-dev-typescript": "~0.8.0", "nativescript-dev-webpack": "^0.21.2", "tslint": "~5.11.0" } }

NickIliev commented 4 years ago

@LakshmiEvana is application.android.on used within your codebase or not? If the latter then please provide a sample app that demonstrates the issue.

If the former then you could apply the code for android only with something like:

import { android as androidApp } from "tns-core-modules/application";

if (androidApp) {
    androidApp .on( // more code follows here...