2017-09-01 71 views
1

我在项目中遇到了这个错误,所以怀疑在firebase方面做了一些改动,我创建了一个全新的nativescript项目,全新的firebase项目与新的新的Android应用程序,添加新的数据库数据,仍然得到相同的错误。错误:未被捕获(承诺中):TypeError:无法读取null的属性'child'

基本上所有firebase.instancenativescript-plugin-firebase插件是空的,突然在没有任何代码的改变从我身边

基本上所有firebase.instancenativescript-plugin-firebase插件都是空的,一下子没有从我身边代码的任何变化。收到对端

错误消息:

JS: Error in firebase.addValueEventListener: TypeError: Cannot read property 'child' of null JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'child' of null JS: TypeError: Cannot read property 'child' of null JS: at file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/nativescript-plugin-firebase/firebase.js:1456:24 JS: at new ZoneAwarePromise (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:776:29) JS: at Object.firebase.addValueEventListener (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/nativescript-plugin-firebase/firebase.js:1444:10) JS: at Observable._subscribe (file:///data/data/org.nativescript.bbnsng/files/app/modules/services/firebase.service.js:23:22) JS: at Observable._trySubscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/Observable.js:57:25) JS: at Observable.subscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/Observable.js:45:27) JS: at Observable.ConnectableObservable.connect (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/observable/ConnectableObservable.js:37:18) JS: at RefCountOperator.call (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/observable/ConnectableObservable.js:101:49) JS: at Observable.subscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/rxjs/Observable.js:42:22) JS: at ObservableStrategy.createSubscription (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/common/bundles/common.umd.js:2664:22) JS: at AsyncPipe._subscribe (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/common/bundles/common.umd.js:2778:45) JS: at AsyncPipe.transform (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/common/bundles/common.umd.js:2755:22) JS: at Object.eval [as updateDirectives] (ng:///HomeModule/HomeComponent.ngfactory.js:127:68) JS: at Object.debugUpdateDirectives [as updateDirectives] (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/core/bundles/core.umd.js:12613:21) JS: at checkAndUpdateView (file:///data/data/org.nativescript.bbnsng/files/app/tns_modules/@angular/core/bundles/core.umd.js:12025:14)

步骤我跟着:

  • 创建一个新的回购
  • 在火力控制台创建一个新的火力点项目
  • 创建该程序下的包名称为的Android应用程序
  • 运行keytool -list -v -keystore ~/.android/bbnsng.keystore得到SHA1,同
  • 更新应用中的一些数据添加到数据库,并允许规则公共
  • 代码了corresponsding nativescript角度应用这种状态https://github.com/ishandutta2007/bb_ns_ng_main_app2
  • 下载google-services.json并将其添加到app/App_Resources/Android/
  • 运行该应用程序。

重现步骤: git clone https://github.com/ishandutta2007/bb_ns_ng_main_app2.git cd bb_ns_ng_main_app2 tns run android

回答

0

对于我来说,添加以下语句app.js/app.ts修复了这个问题提供我已经配置正确的火力数据库。例如:

require("./shared/firebase/firebase.common"); 

对于Angular项目,在main.ts中添加import firebase.common。例如:

import "./shared/firebase/firebase.common"; 
相关问题