Skip to content

Android application doesn't update firebase database #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kaxank opened this issue Jul 30, 2016 · 8 comments
Closed

Android application doesn't update firebase database #184

kaxank opened this issue Jul 30, 2016 · 8 comments

Comments

@kaxank
Copy link

kaxank commented Jul 30, 2016

Hi,

when i "npm start", everything works fine, when i open my browser, my projects home.component.ts starts to update and add 'counters' in my firebase database every 3 seconds. I can see updates in my console.firebase database.

//home.component.ts
export class HomeComponent {
  public newName: string = '';
  constructor(private store: Store<any>, public nameListService: NameListService, private databaseService: DatabaseService) { 
  let count = 0;
      databaseService.sync('counters', (data:any) => {
        console.log('Synced path updated', data);
      });
      setInterval(() => {
        databaseService.addChild('counters', count++);
      }, 3000);
  }
}

When i "npm run start.android", it starts on my device and also an emulator without problem as i see.
After project successfully built,

My Terminal:

npm run start.android

> [email protected] start.android /home/kaank2/Desktop/hitmie
> cd nativescript && tns emulate android

npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No license field.
Executing before-prepare hook from /home/kaank2/Desktop/hitmie/nativescript/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 1.8.10
WARNING: The file: /home/kaank2/Desktop/hitmie/nativescript/node_modules/nativescript-plugin-firebase/platforms/android/README.md is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0

:config phase:  createDefaultIncludeFiles
    +found plugins: nativescript-plugin-firebase
    +found plugins: tns-core-modules-widgets

:config phase:  createPluginsConfigFile
     Creating product flavors include.gradle file in /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations folder...

:config phase:  pluginExtend
    +applying configuration from: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations/nativescript-plugin-firebase/include.gradle
    +applying configuration from: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations/include.gradle
    +applying configuration from: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
    +adding dependency: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/libs/aar/widgets-release.aar
    +adding dependency: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/libs/aar/firebase-release.aar
:deleteMetadata
:deleteFlavors
:clean

BUILD SUCCESSFUL

Total time: 9.983 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.8/userguide/gradle_daemon.html
Project successfully prepared
WARNING: The file: /home/kaank2/Desktop/hitmie/nativescript/node_modules/nativescript-plugin-firebase/platforms/android/README.md is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0

:config phase:  createDefaultIncludeFiles
    +found plugins: nativescript-plugin-firebase
    +found plugins: tns-core-modules-widgets

:config phase:  createPluginsConfigFile
     Creating product flavors include.gradle file in /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations folder...

:config phase:  pluginExtend
    +applying configuration from: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations/nativescript-plugin-firebase/include.gradle
    +applying configuration from: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations/include.gradle
    +applying configuration from: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
    +adding dependency: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/libs/aar/widgets-release.aar
    +adding dependency: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/libs/aar/firebase-release.aar
:preBuild UP-TO-DATE
:preF0F1DebugBuild UP-TO-DATE
:checkF0F1DebugManifest
:preF0F1ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:prepareComAndroidSupportAppcompatV72340Library
:preF0F1DebugAndroidTestBuild UP-TO-DATE
:prepareComAndroidSupportMultidex101Library
:prepareComAndroidSupportSupportV42340Library
:prepareComAndroidSupportSupportVectorDrawable2340Library
:prepareComGoogleAndroidGmsPlayServicesBase920Library
:prepareComGoogleAndroidGmsPlayServicesBasement920Library
:prepareComGoogleAndroidGmsPlayServicesTasks920Library
:prepareComGoogleFirebaseFirebaseAnalytics920Library
:prepareComGoogleFirebaseFirebaseAnalyticsImpl920Library
:prepareComGoogleFirebaseFirebaseAuth920Library
:prepareComGoogleFirebaseFirebaseAuthCommon920Library
:prepareComGoogleFirebaseFirebaseAuthModule920Library
:prepareComGoogleFirebaseFirebaseCommon920Library
:prepareComGoogleFirebaseFirebaseCore920Library
:prepareComGoogleFirebaseFirebaseCrash920Library
:prepareComGoogleFirebaseFirebaseDatabase920Library
:prepareComGoogleFirebaseFirebaseDatabaseConnection920Library
:prepareComGoogleFirebaseFirebaseIid920Library
:prepareFirebaseReleaseLibrary
:preparePrototypeBindingGeneratorUnspecifiedLibrary
:preparePrototypeRuntimeUnspecifiedLibrary
:prepareWidgetsReleaseLibrary
:prepareF0F1DebugDependencies
:compileF0F1DebugAidl
:compileF0F1DebugRenderscript
:generateF0F1DebugBuildConfig
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:asbg:generateInterfaceNamesList
:asbg:runAstParser UP-TO-DATE
:asbg:generateBindings UP-TO-DATE
:generateF0F1DebugAssets UP-TO-DATE
:mergeF0F1DebugAssets
:generateF0F1DebugResValues UP-TO-DATE
:processF0F1DebugGoogleServices
Parsing json file: /home/kaank2/Desktop/hitmie/nativescript/platforms/android/google-services.json
:generateF0F1DebugResources
:mergeF0F1DebugResources
:processF0F1DebugManifest
:processF0F1DebugResources
:generateF0F1DebugSources
:compileF0F1DebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileF0F1DebugNdk UP-TO-DATE
:compileF0F1DebugSources
:buildMetadata
Skip com.google.android.gms.internal.zzt
    Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzw
    Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzy
    Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzz
    Error: java.lang.NullPointerException
Skip org.nativescript.plugins.firebase.MyFirebaseMessagingService
    Error: java.lang.NullPointerException
 'assets/metadata/treeNodeStream.dat'...
 'assets/metadata/treeStringsStream.dat'...
 'assets/metadata/treeValueStream.dat'...
:transformClassesWithJarMergingForF0F1Debug
:collectF0F1DebugMultiDexComponents
:transformClassesWithMultidexlistForF0F1Debug
ProGuard, version 5.2.1
Reading program jar [/home/kaank2/Desktop/hitmie/nativescript/platforms/android/build/intermediates/transforms/jarMerging/F0F1/debug/jars/1/1f/combined.jar]
Reading library jar [/home/kaank2/Android/Sdk/build-tools/23.0.3/lib/shrinkedAndroid.jar]
Note: com.google.android.gms.internal.zzafc calls 'Class.getAnnotation'
Note: com.google.android.gms.internal.zzamp calls 'Field.getAnnotation'
Note: com.google.android.gms.internal.zzant calls 'Class.getAnnotation'
Note: com.google.android.gms.internal.zzant calls 'Field.getAnnotation'
Note: com.google.android.gms.internal.zzaoe calls 'Class.getAnnotation'
Note: com.google.android.gms.internal.zzaoj calls 'Field.getAnnotation'
Note: com.google.android.gms.internal.zzaon$zza calls 'Field.getAnnotation'
Note: com.tns.Runtime calls 'Class.getAnnotation'
Note: android.support.v4.app.NotificationCompatJellybean calls 'Field.getType'
Note: com.google.android.gms.internal.zzalq calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzalq calls 'Class.getTypeParameters'
Note: com.google.android.gms.internal.zzalq$zza calls 'Field.getGenericType'
Note: com.google.android.gms.internal.zzalq$zza calls 'Method.getGenericParameterTypes'
Note: com.google.android.gms.internal.zzanr calls 'Class.getGenericInterfaces'
Note: com.google.android.gms.internal.zzanr calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzanr calls 'Class.getTypeParameters'
Note: com.google.android.gms.internal.zzant calls 'Field.getType'
Note: com.google.android.gms.internal.zzaoj calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzaoj calls 'Field.getGenericType'
Note: com.google.android.gms.internal.zzaoj calls 'Field.getType'
Note: com.google.android.gms.internal.zzaoo calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzapd calls 'Field.getType'
Note: com.tns.Runtime calls 'Field.getType'
Note: com.google.android.gms.internal.zzanr$zzb calls 'Class.getEnclosingClass'
Note: com.tns.Runtime calls 'Class.getEnclosingClass'
Note: android.support.v4.app.NotificationCompatJellybean: can't find dynamically referenced class android.app.Notification$Action
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21$Stub: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks$Stub
Note: android.support.v4.media.ParceledListSliceAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.text.ICUCompatApi23: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v7.widget.DrawableUtils: can't find dynamically referenced class android.graphics.Insets
Note: com.google.android.gms.internal.zzahp: can't find dynamically referenced class com.google.appengine.api.ThreadManager
Note: com.google.android.gms.internal.zzaoa: can't find dynamically referenced class sun.misc.Unsafe
Note: android.support.multidex.MultiDexExtractor accesses a method 'apply()' dynamically
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'icon' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int icon; }'
      Maybe this is program field 'com.hitmie.prototype.R$attr { int icon; }'
      Maybe this is program field 'com.hitmie.prototype.R$drawable { int icon; }'
      Maybe this is program field 'com.hitmie.prototype.R$id { int icon; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'title' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { java.lang.CharSequence title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int title; }'
      Maybe this is program field 'com.hitmie.prototype.R$attr { int title; }'
      Maybe this is program field 'com.hitmie.prototype.R$id { int title; }'
      Maybe this is program field 'org.nativescript.widgets.TabItemSpec { java.lang.String title; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'actionIntent' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { android.app.PendingIntent actionIntent; }'
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21 accesses a method 'asBinder()' dynamically
      Maybe this is program method 'android.support.v4.app.INotificationSideChannel$Stub { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.app.INotificationSideChannel$Stub$Proxy { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.IMediaBrowserServiceAdapterApi21$Stub { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21 { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompat$ServiceCallbacks { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompat$ServiceCallbacksApi21 { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompat$ServiceCallbacksCompat { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompatApi21$ServiceCallbacks { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompatApi21$ServiceCallbacksApi21 { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.session.IMediaControllerCallback$Stub { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.session.IMediaControllerCallback$Stub$Proxy { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.session.IMediaSession$Stub { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.media.session.IMediaSession$Stub$Proxy { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.os.IResultReceiver$Stub { android.os.IBinder asBinder(); }'
      Maybe this is program method 'android.support.v4.os.IResultReceiver$Stub$Proxy { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzq$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzq$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzr$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzs$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzs$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzt$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzt$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzu$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzv$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzw$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.common.internal.zzx$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.dynamic.zzc$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.dynamic.zzc$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.dynamic.zzd$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.dynamic.zzd$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.iid.zzb$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.iid.zzb$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzafj$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzafj$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzafk$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzcc$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzql$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzro$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzro$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzrp$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzsk$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzug$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzug$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.measurement.internal.zzm$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.measurement.internal.zzm$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.signin.internal.zzd$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.signin.internal.zzd$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.android.gms.signin.internal.zze$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.crash.internal.zzd$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.crash.internal.zze$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.crash.internal.zzf$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zze$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zze$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzf$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzf$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzg$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzg$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzh$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzh$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzi$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzi$zza$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzj$zza { android.os.IBinder asBinder(); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzj$zza$zza { android.os.IBinder asBinder(); }'
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21 accesses a method 'onConnectFailed()' dynamically
      Maybe this is program method 'android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21 { void onConnectFailed(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompat$ServiceCallbacks { void onConnectFailed(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompat$ServiceCallbacksApi21 { void onConnectFailed(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompat$ServiceCallbacksCompat { void onConnectFailed(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompatApi21$ServiceCallbacks { void onConnectFailed(); }'
      Maybe this is program method 'android.support.v4.media.MediaBrowserServiceCompatApi21$ServiceCallbacksApi21 { void onConnectFailed(); }'
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21$Stub accesses a method 'asInterface(android.os.IBinder)' dynamically
      Maybe this is program method 'android.support.v4.app.INotificationSideChannel$Stub { android.support.v4.app.INotificationSideChannel asInterface(android.os.IBinder); }'
      Maybe this is program method 'android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21$Stub { java.lang.Object asInterface(android.os.IBinder); }'
      Maybe this is program method 'android.support.v4.media.session.IMediaControllerCallback$Stub { android.support.v4.media.session.IMediaControllerCallback asInterface(android.os.IBinder); }'
      Maybe this is program method 'android.support.v4.media.session.IMediaSession$Stub { android.support.v4.media.session.IMediaSession asInterface(android.os.IBinder); }'
      Maybe this is program method 'android.support.v4.os.IResultReceiver$Stub { android.support.v4.os.IResultReceiver asInterface(android.os.IBinder); }'
      Maybe this is program method 'com.google.android.gms.internal.zzug$zza { com.google.android.gms.internal.zzug asInterface(android.os.IBinder); }'
      Maybe this is program method 'com.google.firebase.database.connection.idl.zzh$zza { com.google.firebase.database.connection.idl.zzh asInterface(android.os.IBinder); }'
Note: android.support.v4.text.ICUCompatApi23 accesses a method 'addLikelySubtags(java.util.Locale)' dynamically
      Maybe this is program method 'android.support.v4.text.ICUCompatIcs { java.lang.String addLikelySubtags(java.util.Locale); }'
Note: android.support.v4.text.ICUCompatIcs accesses a method 'getScript(java.lang.String)' dynamically
      Maybe this is program method 'android.support.v4.text.ICUCompatIcs { java.lang.String getScript(java.lang.String); }'
Note: android.support.v4.text.ICUCompatIcs accesses a method 'addLikelySubtags(java.lang.String)' dynamically
Note: android.support.v7.widget.DrawableUtils accesses a method 'getOpticalInsets()' dynamically
Note: android.support.v7.widget.ViewUtils accesses a method 'makeOptionalFitsSystemWindows()' dynamically
Note: com.google.android.gms.common.internal.DowngradeableSafeParcel accesses a field 'NULL' dynamically
      Maybe this is program field 'com.google.android.gms.common.internal.safeparcel.SafeParcelable { java.lang.String NULL; }'
Note: com.google.android.gms.internal.zzafr accesses a declared method 'get(java.lang.String)' dynamically
      Maybe this is program method 'com.google.android.gms.internal.zzagb { java.lang.String get(java.lang.String); }'
      Maybe this is program method 'com.google.android.gms.measurement.internal.EventParams { java.lang.Object get(java.lang.String); }'
      Maybe this is program method 'com.google.firebase.iid.zzg { java.lang.String get(java.lang.String); }'
Note: com.google.android.gms.internal.zzahp accesses a method 'backgroundThreadFactory()' dynamically
Note: com.google.android.gms.internal.zzaoa accesses a declared field 'theUnsafe' dynamically
Note: com.google.android.gms.internal.zzaoa accesses a method 'allocateInstance(java.lang.Class)' dynamically
Note: com.google.android.gms.internal.zzsj accesses a declared field 'MODULE_ID' dynamically
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.ModuleDescriptor { java.lang.String MODULE_ID; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags.ModuleDescriptor { java.lang.String MODULE_ID; }'
Note: com.google.android.gms.internal.zzsj accesses a declared field 'MODULE_VERSION' dynamically
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.ModuleDescriptor { int MODULE_VERSION; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags.ModuleDescriptor { int MODULE_VERSION; }'
Note: com.google.android.gms.measurement.internal.zzac accesses a declared method 'initialize(android.content.Context)' dynamically
      Maybe this is program method 'com.google.android.gms.internal.zzue { void initialize(android.content.Context); }'
      Maybe this is program method 'com.google.android.gms.internal.zzuf { void initialize(android.content.Context); }'
      Maybe this is program method 'com.google.firebase.crash.internal.config.flag.Flags { void initialize(android.content.Context); }'
Note: the configuration refers to the unknown method 'void attachBaseContext(android.content.Context)' in class 'com.tns.NativeScriptApplication'
Note: there were 1 references to unknown class members.
      You should check your configuration for typos.
Note: there were 8 classes trying to access annotations using reflection.
      You should consider keeping the annotation attributes
      (using '-keepattributes *Annotation*').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 15 classes trying to access generic signatures using reflection.
      You should consider keeping the signature attributes
      (using '-keepattributes Signature').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 2 classes trying to access enclosing classes using reflection.
      You should consider keeping the inner classes attributes
      (using '-keepattributes InnerClasses').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 10 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 20 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Note: you're ignoring all warnings!
Preparing output jar [/home/kaank2/Desktop/hitmie/nativescript/platforms/android/build/intermediates/multi-dex/F0F1/debug/componentClasses.jar]
  Copying resources from program jar [/home/kaank2/Desktop/hitmie/nativescript/platforms/android/build/intermediates/transforms/jarMerging/F0F1/debug/jars/1/1f/combined.jar]
:transformClassesWithDexForF0F1Debug
:mergeF0F1DebugJniLibFolders
:transformNative_libsWithMergeJniLibsForF0F1Debug
:processF0F1DebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForF0F1Debug
:validateDebugSigning
:packageF0F1Debug
:zipalignF0F1Debug
:assembleF0F1Debug
:assembleDebug
:buildapk

BUILD SUCCESSFUL

Total time: 52.991 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.8/userguide/gradle_daemon.html
Project successfully built
Successfully deployed on device with identifier 'LGH73fgk92f8bd'.
JS: NSAppCmp ----
JS: Language change: en
JS: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
JS: Constructing NSDatabaseService
JS: firebase.init successful
JS: Synced path updated [object Object]
JS: created key: -KNwCGRV7XjwmwgoUP406
JS: created key: -KNwCHAdYOlJMueqipnbe
JS: created key: -KNwCHubTdNSZsWTrvBI
JS: created key: -KNwCIdahF1hDjsqweoSbj
JS: created key: -KNwCJNXiyXaroasdlInns
JS: created key: -KNwCK6WkBrMasdopNeUUL
JS: created key: -KNwCKqVjZlGRWeK_uxX5

In every 3 seconds, it creates keys but I can't see any added counters on my console.firebase database and i dont see any errors that i can fix.

When i 'npm start' and then in another terminal 'npm run start.android',
From my android terminal, i can see the firebase database is updated by my web project add counter function, but my android application is not updating the firebase database.

My Android Terminal

JS: Constructing NSDatabaseService
JS: firebase.init successful
JS: Synced path updated [object Object]
JS: created key: -KNwBHxLlimqiOeasA73G
JS: Synced path updated [object Object]
JS: Synced path updated [object Object]
JS: created key: -KNwBIgbat3zLTeweeGFw
JS: created key: -KNwBJQZq1pySeF1H7VC-
JS: Synced path updated [object Object]
JS: Synced path updated [object Object]
JS: created key: -KNwBKAHIKEyxwzZHItQm

Expected/desired behavior
How can i connect my both web and android device to my firebase database and make them update firebase database synchronously?

Thank you for this amazing project.
Kaan

@kaxank kaxank changed the title Android application don't update firebase database Android application doesn't firebase database Jul 30, 2016
@kaxank kaxank changed the title Android application doesn't firebase database Android application doesn't update firebase database Jul 30, 2016
@NathanWalker
Copy link
Owner

Hi @blackmr, could you post what your NSDatabaseService looks like?
Just double-checking that you following this wiki article on setting up firebase for both {N} and web?

@kaxank
Copy link
Author

kaxank commented Jul 31, 2016

Hi,
Yes I am trying for setting up firebase for both for {N} and web.
I began with "NathanWalker/angular2-seed-advanced"
then
https://github.com/NathanWalker/angular2-seed-advanced/wiki/How-to-integrate-Firebase-across-all-platforms-(web-nativescript-desktop)
then
https://github.com/EddyVerbruggen/nativescript-plugin-firebase

My NSDatabaseService:
"nativescript/app/shared/core/services/database.service.ts"

import {Injectable, Inject} from '@angular/core';
import {FIREBASE} from '../../../app/frameworks/core/index'

@Injectable()
export class NSDatabaseService {
  private database:any;
  private onSync:Function;
  private userID:string;
  constructor(@Inject(FIREBASE) firebase:any) {
    console.log('Constructing NSDatabaseService');
    this.database = firebase;
    this.database.init({
      persist: true // Allow disk persistence. Default false.
    }).then((instance:any) => {
      console.log('firebase.init successful');
    }, (error:any) => {
      console.log('firebase.init error: ' + error);
    });
  }

  sync(path: string, onValueReceived: Function):void {
    this.onSync = (result:any) => onValueReceived(result.value);
    this.database.addValueEventListener(this.onSync, path);
  }

  addChild(path:string, data:any, callback?:Function):void {
    this.database.push(path, data).then(function (result:any) {
      console.log('created key: ' + result.key);
      if (callback) {
        callback(result.key)
      }
    });
  }
}

nativescript/app/app.ts

// nativescript
import {nativeScriptBootstrap} from 'nativescript-angular/application';
import {NS_ROUTER_DIRECTIVES,NS_ROUTER_PROVIDERS, nsProvideRouter} from 'nativescript-angular/router';

// angular 
import {provide, enableProdMode} from '@angular/core';

// libs
import {TranslateLoader} from 'ng2-translate/ng2-translate';
import {TNSTranslateLoader} from 'nativescript-ng2-translate/nativescript-ng2-translate';

// config
import {Config, WindowService, HttpService, DatabaseService} from './app/frameworks/core/index';
import {FIREBASE} from './app/frameworks/core/index';
Config.PLATFORM_TARGET = Config.PLATFORMS.MOBILE_NATIVE;
Config.DEBUG.LEVEL_4 = true;
Config.ROUTER_DIRECTIVES = NS_ROUTER_DIRECTIVES;

// app

import {routes} from './app/components/app/app.routes';
import {NS_APP_PROVIDERS} from './shared/nativescript/index';
import {NSAppComponent} from './pages/app/app.component';
import {WindowNative, ModalNative, NSHttpService, NSDatabaseService} from './shared/core/index';

// Uncomment when ready to publish to App Stores:
// enableProdMode();

var firebase = require('nativescript-plugin-firebase');

nativeScriptBootstrap(NSAppComponent, [
  provide(WindowService, { useClass: WindowNative }),
  ModalNative,
  provide(HttpService, { useClass: NSHttpService }),
  provide(FIREBASE, { useValue: firebase }),
  provide(DatabaseService, { useClass: NSDatabaseService }),
  NS_ROUTER_PROVIDERS,
  provide(TranslateLoader, {
    useFactory: () => {
      return new TNSTranslateLoader('assets/i18n');
    }
  }),
  NS_APP_PROVIDERS,
  nsProvideRouter(routes, { enableTracing: false })
]);

Thank you for your effort...
Kaan

@NathanWalker
Copy link
Owner

NathanWalker commented Jul 31, 2016

I'll update the wiki in moment but 2 things you should modify with your NSDatabaseService (ensure callbacks are run in NgZone):

import {NgZone} from '@angular/core';

constructor(@Inject(FIREBASE) firebase:any, private ngZone: NgZone) {
 ... removed for brevity...

sync(path: string, onValueReceived: Function):void {
    this.database.addValueEventListener((result:any) => {
        this.ngZone.run(() => {
          onValueReceived(result.value);
        });
    }, path);
  }

  addChild(path:string, data:any, callback?:Function):void {
    this.database.push(path, data).then((result:any) => {   // notice you were using `function`, use fat arrow instead
      console.log('created key: ' + result.key);
      if (callback) {
        this.ngZone.run(() => {
          callback(result.key);
        });
      }
    });
  }

Try that and lemme know.

@sozgul
Copy link

sozgul commented Aug 2, 2016

Hey Nathan,

I'm working with @blackmr to extend your seed setup to our project. We have updated the code as your instructions, however we are still unable to identify why the android application would not update the firebase database.

One thing that we forgot to mention is that the iOS application is able to update the firebase database. Even before the changes you suggested, the previous configuration was able to update to firebase. The Electron app for desktop also gives errors and we simply couldn't get it to work with the provided instructions of the wiki. (cannot find file dist/dev/node_modules/firebase/firebase.js)

If I understand correctly both the iOS and Android apps use NSDatabaseService located in /nativescript/app/shared/core/services/database.service. I downloaded the google-services.json to see if it was a configuration issue but it didn't work. Firebase initializes successfully, but the subsequent keys created do not show up in the database.

I know firebase is out of the scope of your seed but could you please guide us through error catching and maybe running an onComplete function on the response to monitor what response we receive from firebase?

Thank you for your help.

Best
Serhan

@kaxank
Copy link
Author

kaxank commented Aug 3, 2016

Hi,

I guess firebase doesn't return a response. So 'callback' is not defined and 'if' conditional never gets invoked.
Still i don't understand why ios update firebase and Android can't, although firebase initiates successfully.

  addChild(path:string, data:any, callback?:Function):void {
    this.database.push(path, data).then((result:any) => {
      console.log('created key: ' + result.key);
      if (callback) {
        this.ngZone.run(() => {
          callback(result.key);
        });
      }
    });
  }

Thank you

@sozgul
Copy link

sozgul commented Aug 3, 2016

EddyVerbruggen/nativescript-plugin-firebase#58

This issue from the EddyVerburgen's plugin is describing the exact same issue regarding Android app not updating Firebase. I hope his approach might inspire a solution. However, after a while he concluded that it wasn't an issue about the plugin and I believe isn't actively working on the issue.

@lowe0292
Copy link

Following up here @sozgul. This ended up being a dead end for me. Did you or @blackmr ever crack the code?

@NathanWalker
Copy link
Owner

Feel free to continue discussion here, just closing to cleanup outstanding issues. Any solution if found here could be posted to the wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants