gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 10:38:13 25 4
gpt4 key购买 nike

我在我的应用程序中实现了 firebase analytics,但没有显示任何事件或登录 fire base 控制台。

onCreateView() 方法的每个 fragment 中添加下面的代码。

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

那么,这里出了什么问题?请帮忙。

最佳答案

最后我通过将 tools:node="replace"替换为 tools:node="merge" 并添加 tools:replace="android:label" 解决了这个问题在 list 文件中。

引用:FirebaseApp with name [DEFAULT] doesn't exist

关于android - Firebase 分析事件未显示在 Firebase 控制台上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39306870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com