简体   繁体   English

在 firebase 分析调试视图中看不到事件

[英]Cannot see events in firebase analytics debug view

I'm trying to run a sample app with firebase analytics.我正在尝试使用 firebase 分析运行示例应用程序。 I followed the firebase analytics guides to log a test event but I cannot see any events in the debug view.我按照 firebase 分析指南记录测试事件,但在调试视图中看不到任何事件。 I log a test event on my main activity as below:我在我的主要活动中记录了一个测试事件,如下所示:

public class MainActivity extends AppCompatActivity
{
    private FirebaseAnalytics mFirebaseAnalytics;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

        Bundle bundle = new Bundle();
        bundle.putString("test_parameter", "test_value");
        mFirebaseAnalytics.logEvent("test_event", bundle);
    }
}

And I use the following command to see my events in the debug view:我使用以下命令在调试视图中查看我的事件:

adb shell setprop debug.firebase.analytics.app com.example.firebaseanalyticssample

And I see the logs with the following commands:我看到带有以下命令的日志:

adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

I think maybe the problem is the null pointer exception appeared in the logs (the last line):我想问题可能是日志中出现了 null 指针异常(最后一行):

05-25 09:25:53.056 V/FA      (21533): Processing queued up service tasks: 2
05-25 09:25:53.086 V/FA-SVC  ( 5655): Logging event: origin=auto,name=_e,params=Bundle[mParcelledData.dataSize=132]
05-25 09:25:53.101 V/FA-SVC  ( 5655): Saving event, name, data size: _e, 87
05-25 09:25:53.106 V/FA-SVC  ( 5655): Event recorded: Event{appId='com.example.firebaseanalyticssample', name='_e', params=Bundle[{_o=auto, _r=1, _et=52395, _sc=MainActivity, _si=-5268297315019047641, _dbg=1}]}
05-25 09:25:53.106 V/FA-SVC  ( 5655): Upload scheduled in approximately ms: 500
05-25 09:25:53.111 V/FA-SVC  ( 5655): Background event processing time, ms: 31
05-25 09:25:53.621 V/FA-SVC  ( 5655): Device receiver got: com.google.android.gms.measurement.UPLOAD
05-25 09:25:53.646 V/FA-SVC  ( 5655): Device PackageMeasurementService called. startId, action: 194, com.google.android.gms.measurement.UPLOAD
05-25 09:25:53.651 D/FA-SVC  ( 5655): Uploading events. Elapsed time since last upload attempt (ms): 544
05-25 09:25:53.666 E/FA-SVC  ( 5655): Task exception on worker thread: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference: vgq.s(:com.google.android.gms:2650)

I searched a lot and just found this link regarding the exception above that says it must be an error from another application.我搜索了很多,只是找到了这个关于上面异常的链接,上面说它一定是来自另一个应用程序的错误。 but whenever my activity is resumed this exception occurs.但是每当我的活动恢复时,就会发生此异常。 I don't think that in my case this exception is caused by another apps.我不认为在我的情况下这个异常是由另一个应用程序引起的。

I checked my sample app a lot of times so that every configuration would be exactly as the guides say.我多次检查我的示例应用程序,以便每个配置都完全按照指南所说的那样。 Have you any idea what can be the problem?你知道可能是什么问题吗?

To enable sending of DebugView data on a connected Android test device for a configured Firebase Analytics app, execute the following command: 要在已连接的Android测试设备上为已配置的Firebase Analytics应用程序发送DebugView数据,请执行以下命令:

adb shell setprop debug.firebase.analytics.app <package_name>

This behavior persists until you explicitly disable it by executing the following command: 在您通过执行以下命令显式禁用它之前,此行为将持续存在:

adb shell setprop debug.firebase.analytics.app .none.

iOS test device setup is as easy as Android, just use there Xcode command line arguments correspondingly: iOS测试设备设置就像Android一样简单,只需相应地使用Xcode命令行参数:

–FIRDebugEnabled and -FIRDebugEnabled和

–FIRDebugDisabled -FIRDebugDisabled

Try this 试试这个

  private FirebaseAnalytics mFirebaseAnalytics;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mFirebaseAnalytics = FirebaseAnalytics.getInstance(getApplicationContext());

    mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);

    mFirebaseAnalytics.setMinimumSessionDuration(10000);

    mFirebaseAnalytics.setSessionTimeoutDuration(300);


    Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID,"ID");
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME,"NAME");
    bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE,"image");

   mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
   }

You can enable verbose logging with a series of adb commands: 您可以使用一系列adb命令启用详细日志记录:

adb shell setprop log.tag.FA VERBOSE adb shell setprop log.tag.FA VERBOSE

adb shell setprop log.tag.FA-SVC VERBOSE adb shell setprop log.tag.FA-SVC VERBOSE

adb logcat -v time -s FA FA-SVC adb logcat -v time -s FA FA-SVC

REF: https://firebase.google.com/docs/analytics/android/start/ 参考: https//firebase.google.com/docs/analytics/android/start/

I changed my development android phone and it got worked. 我改变了我的开发Android手机,它开始工作了。 it got worked with samsung SM-P601 and Huawei ِY560-U02 but it just kept throwing the exception below for android mobile phone samsung SM-J120F: 它与三星SM-P601和华为Y560-U02配合使用,但它一直在为Android手机三星SM-J120F抛出异常:

05-25 09:25:53.666 E/FA-SVC  ( 5655): Task exception on worker thread: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference: vgq.s(:com.google.android.gms:2650)

I checked google play services version in these three mobile phones and it was the same in all of them. 我在这三部手机上查看了谷歌播放服务版本,所有这些都是一样的。 I don't know what causes SM-J120F not to work. 我不知道是什么原因导致SM-J120F无法正常工作。

执行启用调试模式后,请确保调试设备或仿真器和PC中的日期和时间正确无误。

Didn't work for me. 不适合我。 But from logs, I've found that you need to add flavor name too. 但是从日志中我发现你还需要添加风味名称。 So, I had a flavor named "internal" and had to write com.package.name.internal in that adb command above. 所以,我有一个名为“internal”的味道,并且必须在上面的adb命令中编写com.package.name.internal。

In my case, I was using illegal characters in the name field.就我而言,我在name字段中使用了非法字符。

Logcat gave the hint why this was happening to me: I was using a blank space in the name, which is illegal. Logcat提示了为什么会发生这种情况:我在名称中使用了空格,这是非法的。 You can only use [A-Za-z0-9_] .您只能使用[A-Za-z0-9_]

Here my error message:这是我的错误信息:

E/FA: Name must consist of letters, digits or _ (underscores).

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase 分析调试视图不显示任何内容 - Firebase Analytics Debug View does not show anything 在 Firebase Analytics 中看不到 Flutter Web 活动历史记录 - Cannot see Flutter Web activity history in Firebase Analytics 删除 firebase 分析事件 - Delete firebase analytics events Firebase Analytics - 如何查看特定内容而不是 controller? - Firebase Analytics - How to see specific content and not a controller? 在 Firebase 分析控制台 (Swift) 中记录自定义事件 - Logging custom events in the Firebase Analytics console (Swift) 如何在 firebase 分析自定义事件中将对象数组作为参数传递 - How to pass array of objects as parameter in firebase analytics custom events 用于 Android/Kotlin 应用程序中用户视图的 Firebase Analytics - Firebase Analytics for User View in Android/Kotlin App firebase deploy - 如何查看部署了哪些文件并调试 gcloudignore? - firebase deploy - how to see which files are deployed and debug gcloudignore? Firebase 分析不提供自定义事件详细信息(总计)0 项 - Firebase analytics not give Custom events details instead (total) 0 items Firebase 事件的 Google Analytics,因为 Google Ads 中的转化不适用于 Android - Google Analytics for Firebase events as conversions in Google Ads not working for Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM