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

我在我的应用程序中实现了firebase分析,但没有显示任何事件或登录fire base console.

在onCreateView()方法的每个片段中添加波纹管代码.

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'

它的工作正常并在调试控制台中显示这样的日志,

    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控制台中显示任何上传消息,

那么,这里有什么不对吗?请帮忙.

最佳答案 最后我通过替换工具解决了这个问题:node =“replace”to tools:node =“merge”并在menifest文件中添加工具:replace =“android:label”.

参考:FirebaseApp with name [DEFAULT] doesn’t exist

点赞