Vishal Gadhiya
Vishal Gadhiya

Reputation: 578

Firebase analytics event not show up on firebase console

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.

Upvotes: 10

Views: 21843

Answers (3)

Dan Morenus
Dan Morenus

Reputation: 1088

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?

Upvotes: 0

Rexcirus
Rexcirus

Reputation: 2897

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.

Upvotes: 0

Vishal Gadhiya
Vishal Gadhiya

Reputation: 578

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

Upvotes: 3

Related Questions