10

I have implement firebase analytics in my app, but not show up any event or log in fire base console.

Add bellow code in each fragment in onCreateView() method.

private void addFragmentInFirebaseAnalytics() {

    FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(getContext());
    FragmentItem fragmentItem = new FragmentItem();
    fragmentItem.setFragmentId(Constant.FM_ID_MOIST_AIR);
    fragmentItem.setFragmentName(MoistAirActivity.class.getSimpleName());

    Bundle bundle = new Bundle();
    bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, fragmentItem.getFragmentId());
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, fragmentItem.getFragmentName());

    //Logs an app event.
    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
    Log.d(TAG,"bundle >>"+bundle);
}

Used dependency is :

compile 'com.google.firebase:firebase-core:9.4.0'

used plugin :

apply plugin: 'com.google.gms.google-services'

Its work fine and show log like this in debug console,

    09-14 12:30:42.967 D/FA      ( 8821): Logging event (FE): select_content, Bundle
[{_o=app, _ev=item_id, item_name=MoistAirActivity, content_type=Navigation Menu,
 _err=4}]
09-14 12:30:42.977 V/FA      ( 8821): Using measurement service
09-14 12:30:42.977 V/FA      ( 8821): Connecting to remote service
09-14 12:30:43.217 D/FA      ( 8821): Connected to remote service
09-14 12:30:43.217 V/FA      ( 8821): Processing queued up service tasks: 1
09-14 12:30:43.217 E/FA      ( 8821): Task exception on worker thread: java.lang
.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist. : com.goo
gle.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
09-14 12:30:48.217 V/FA      ( 8821): Inactivity, disconnecting from AppMeasurem
entService

but not show any uploading message in debug console and firebase console after 24 hours,

So, whats wrong here ? please help.

Vishal Gadhiya
  • 450
  • 1
  • 6
  • 21

3 Answers3

3

Finally i resolved this problem by replacing tools:node="replace" to tools:node="merge" and add tools:replace="android:label" in menifest file.

Reference : FirebaseApp with name [DEFAULT] doesn't exist

Community
  • 1
  • 1
Vishal Gadhiya
  • 450
  • 1
  • 6
  • 21
0

There are a few things that could be going on here. You will see more diagnostic messages if you run:

adb shell setprop log.tag.FA VERBOSE  

and if your test device has Google Play Services installed, also run:

adb shell setprop log.tag.FA-SVC VERBOSE

Those commands will display more information in your logcat. Are there any errors from FA or FA-SVC on application startup?

Vivek Mishra
  • 5,669
  • 9
  • 46
  • 84
Dan Morenus
  • 1,068
  • 8
  • 12
  • Now every thing is working fine and logged firebase message, but data not upload on firebase console and generate exception E/FA: Task exception on worker thread: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist. : com.google.android.gms.measurement.internal.zzt.zzbpu(Unknown Source) – Vishal Gadhiya Sep 08 '16 at 14:25
  • Take a look at this answer and see if it helps: http://stackoverflow.com/questions/37342403/firebaseapp-with-name-default-doesnt-exist – Dan Morenus Sep 08 '16 at 15:48
  • Have you tried the ideas in this answer? http://stackoverflow.com/questions/37531749/firebaseapp-with-name-default-doesnt-exist-getting-error – Dan Morenus Sep 10 '16 at 17:33
0

For me this worked:

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

in the AndroidManifest.xml.

I've not specified any tools attribute.

Rexcirus
  • 2,459
  • 3
  • 22
  • 42