System.err: TypeError: Cannot read property 'getInstance' of undefined #829
Description
Hello Guys,
i'm getting the following error in Android. I don't know what am doing wrong. Any help will be much appreciated.
Thanks.
JS: Angular is running in the development mode. Call enableProdMode() to enable the production mode. System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amole.notify/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: System.err: Calling js method onCreate failed System.err: TypeError: Cannot read property 'getInstance' of undefined System.err: File: "file:///data/data/com.amole.notify/files/app/tns_modules/nativescript-plugin-firebase/firebase.js, line: 286, column: 69 System.err: StackTrace: System.err: Frame: function:'runInit', file:'file:///data/data/com.amole.notify/files/app/tns_modules/nativescript-plugin-firebase/firebase.js', line: 286, column: 70 System.err: Frame: function:'Observable.notify', file:'file:///data/data/com.amole.notify/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 110, column: 23 System.err: Frame: function:'notifyLaunch', file:'file:///data/data/com.amole.notify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 870, column: 17 System.err: Frame: function:'ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/com.amole.notify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 803, column: 28 System.err: Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/com.amole.notify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 677, column: 14 System.err: Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/com.amole.notify/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
package.json
"nativescript": { "id": "com.amole.notify", "tns-android": { "version": "4.1.3" } }, "scripts": { "lint": "tslint \"app/**/*.ts\"" }, "dependencies": { "@angular/animations": "~6.0.6", "@angular/common": "~6.0.6", "@angular/compiler": "~6.0.6", "@angular/core": "~6.0.6", "@angular/forms": "~6.0.6", "@angular/http": "~6.0.6", "@angular/platform-browser": "~6.0.6", "@angular/platform-browser-dynamic": "~6.0.6", "@angular/router": "~6.0.6", "nativescript-angular": "~6.0.6", "nativescript-plugin-firebase": "^6.4.1", "nativescript-theme-core": "~1.0.4", "nativescript-ui-sidedrawer": "~4.1.0", "reflect-metadata": "~0.1.10", "rxjs": "~6.1.0", "tns-core-modules": "4.1.1", "zone.js": "~0.8.18" },
app.gradle
`android {
defaultConfig {
generatedDensities = []
applicationId = "com.amole.notify"
multiDexEnabled true
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
dexOptions {
javaMaxHeapSize "4g"
}
project.ext {
googlePlayServicesVersion = "11.8.0"
}
}`
`buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}`
main.ts | i also moved it to app.component.ts still had the same error.
`import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { AppModule } from "./app.module";
import * as Firebase from 'nativescript-plugin-firebase';
Firebase.init({})
.then((instance) => {
console.log('firebase.init done');
}, (error) => {
console.log(firebase.init error: ${error}
);
});
platformNativeScriptDynamic().bootstrapModule(AppModule);`