Firebase分析事件未显示在Firebase控制台上

Firebase分析事件未显示在Firebase控制台上

本文介绍了Firebase分析事件未显示在Firebase控制台上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中实现了firebase analytics,但未显示任何事件或登录Fire Base控制台.

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

onCreateView()方法的每个片段中添加以下代码.

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);
}

使用的依赖项是:

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

二手插件:

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

但在24小时后不会在调试控制台和firebase控制台中显示任何上传消息,

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

那么,这是怎么了?请帮忙.

So, whats wrong here ? please help.

推荐答案

最后,我通过替换tools:node="replace" to tools:node="merge"并在清单文件中添加tools:replace="android:label"来解决了此问题.

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

参考:名称为[DEFAULT]的FirebaseApp不存在

这篇关于Firebase分析事件未显示在Firebase控制台上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 12:12