我正在我的应用中尝试使用Firebase Analytics,我认为我已经完成了所有初始设置。我用这个命令检查了登录终端:
adb logcat -v time -s FA FA-SVC
这是日志输出 -
09-26 11:20:09.760 V/FA (27438): Activity resumed, time: 3451189692
09-26 11:20:11.216 V/FA (27438): Activity paused, time: 3451191151
09-26 11:22:44.674 I/FA ( 5784): App measurement is starting up, version: 9080
09-26 11:22:44.674 I/FA ( 5784): To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-26 11:22:44.674 D/FA ( 5784): Debug logging enabled
09-26 11:22:44.674 D/FA ( 5784): AppMeasurement singleton hash: 74700849
09-26 11:22:44.690 V/FA ( 5784): Collection enabled
09-26 11:22:44.690 V/FA ( 5784): App package, google app id: com.gaadi.sfa.dev, 1:450847066500:android:80a026686cf10a8d
09-26 11:22:44.708 V/FA ( 5784): Registered activity lifecycle callback
09-26 11:22:44.714 V/FA ( 5784): Using measurement service
09-26 11:22:44.715 V/FA ( 5784): Connecting to remote service
09-26 11:22:44.859 V/FA ( 5784): onActivityCreated
09-26 11:22:45.011 D/FA ( 5784): Logging event (FE): select_content, Bundle[{item_name=Splash screen opened, _o=app, item_id=7}]
09-26 11:22:45.012 V/FA ( 5784): Using measurement service
09-26 11:22:45.012 V/FA ( 5784): Connection attempt already in progress
09-26 11:22:45.012 D/FA ( 5784): Setting app measurement enabled (FE): true
09-26 11:22:45.012 V/FA ( 5784): Setting measurementEnabled: true
09-26 11:22:45.014 V/FA ( 5784): Using measurement service
09-26 11:22:45.014 V/FA ( 5784): Connection attempt already in progress
09-26 11:22:45.035 V/FA ( 5784): Activity resumed, time: 3451344970
09-26 11:22:45.240 D/FA ( 5784): Connected to remote service
09-26 11:22:45.240 V/FA ( 5784): Processing queued up service tasks: 3
09-26 11:22:45.273 V/FA-SVC ( 784): Logging event: origin=app,name=select_content,params=Bundle[mParcelledData.dataSize=140]
09-26 11:22:45.539 V/FA-SVC ( 784): Saving event, name, data size: select_content, 66
09-26 11:22:45.540 V/FA-SVC ( 784): Event recorded: Event{appId='com.gaadi.sfa.dev', name='select_content', params=Bundle[{item_name=Splash screen opened, _o=app, item_id=7}]}
09-26 11:22:45.565 V/FA-SVC ( 784): Upload scheduled in approximately ms: 14382
09-26 11:22:45.575 V/FA-SVC ( 784): Background event processing time, ms: 303
09-26 11:22:48.198 V/FA ( 5784): Activity paused, time: 3451348134
09-26 11:22:48.346 V/FA ( 5784): Activity resumed, time: 3451348281
09-26 11:22:50.263 V/FA ( 5784): Inactivity, disconnecting from AppMeasurementService
09-26 11:22:50.534 I/FA ( 6365): App measurement is starting up, version: 9452
09-26 11:22:50.535 I/FA ( 6365): To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-26 11:22:50.535 D/FA ( 6365): Debug logging enabled
09-26 11:22:50.535 D/FA ( 6365): AppMeasurement singleton hash: 241818726
09-26 11:22:50.549 V/FA ( 6365): Collection enabled
09-26 11:22:50.549 V/FA ( 6365): App package, google app id: com.gaadi.app, 1:29823256680:android:0379d7b84ea091f3
09-26 11:22:50.558 V/FA ( 6365): Registered activity lifecycle callback
09-26 11:22:50.568 V/FA ( 6365): Using measurement service
09-26 11:22:50.576 V/FA ( 6365): Connecting to remote service
09-26 11:22:50.726 D/FA ( 6365): Connected to remote service
09-26 11:22:50.726 V/FA ( 6365): Processing queued up service tasks: 1
09-26 11:22:55.183 V/FA ( 5784): Session started, time: 3451355119
09-26 11:22:55.187 D/FA ( 5784): Logging event (FE): _s, Bundle[{_o=auto}]
09-26 11:22:55.187 V/FA ( 5784): Using measurement service
09-26 11:22:55.187 V/FA ( 5784): Connecting to remote service
09-26 11:22:55.194 D/FA ( 5784): Connected to remote service
09-26 11:22:55.195 V/FA ( 5784): Processing queued up service tasks: 1
09-26 11:22:55.198 V/FA-SVC ( 784): Logging event: origin=auto,name=_s,params=Bundle[mParcelledData.dataSize=36]
09-26 11:22:55.207 V/FA-SVC ( 784): Saving event, name, data size: _s, 19
09-26 11:22:55.211 V/FA-SVC ( 784): Event recorded: Event{appId='com.gaadi.sfa.dev', name='_s', params=Bundle[{_o=auto}]}
09-26 11:22:55.217 V/FA-SVC ( 784): Upload scheduled in approximately ms: 14967
09-26 11:22:55.224 V/FA-SVC ( 784): Background event processing time, ms: 26
09-26 11:22:55.743 V/FA ( 6365): Inactivity, disconnecting from AppMeasurementService
09-26 11:23:00.199 V/FA ( 5784): Inactivity, disconnecting from AppMeasurementService
09-26 11:23:10.373 V/FA-SVC ( 784): Device receiver got: com.google.android.gms.measurement.UPLOAD
09-26 11:23:10.381 V/FA-SVC ( 784): Device PackageMeasurementService is starting up
09-26 11:23:10.381 V/FA-SVC ( 784): Device PackageMeasurementService called. startId, action: 1, com.google.android.gms.measurement.UPLOAD
09-26 11:23:10.386 V/FA-SVC ( 784): Device receiver got: com.google.android.gms.measurement.UPLOAD
09-26 11:23:10.398 V/FA-SVC ( 784): Device PackageMeasurementService called. startId, action: 2, com.google.android.gms.measurement.UPLOAD
09-26 11:23:10.514 D/FA-SVC ( 784): Uploading events. Elapsed time since last upload attempt (ms): 36507706
09-26 11:23:10.522 V/FA-SVC ( 784): Fetching remote configuration: com.gaadi.sfa.dev
09-26 11:23:10.526 D/FA-SVC ( 784): Uploading events. Elapsed time since last upload attempt (ms): 36507847
09-26 11:23:10.528 V/FA-SVC ( 784): Fetching remote configuration: com.gaadi.sfa.dev
09-26 11:23:10.530 V/FA-SVC ( 784): Device PackageMeasurementService processed last upload request
09-26 11:23:10.530 V/FA-SVC ( 784): Device PackageMeasurementService is shutting down
09-26 11:23:11.394 V/FA-SVC ( 784): Successfully fetched config. Got network response. code, size: 304, 0
09-26 11:23:11.428 V/FA-SVC ( 784): Saving bundle, size: 437
09-26 11:23:11.429 D/FA-SVC ( 784): Uploading events. Elapsed time since last upload attempt (ms): 36508720
09-26 11:23:11.448 V/FA-SVC ( 784): Uploading data. app, uncompressed size, data: com.gaadi.sfa.dev, 475,
09-26 11:23:11.448 V/FA-SVC ( 784): batch {
09-26 11:23:11.448 V/FA-SVC ( 784): bundle {
09-26 11:23:11.448 V/FA-SVC ( 784): protocol_version: 1
09-26 11:23:11.448 V/FA-SVC ( 784): platform: android
09-26 11:23:11.448 V/FA-SVC ( 784): gmp_version: 9080
09-26 11:23:11.448 V/FA-SVC ( 784): uploading_gmp_version: 9683
09-26 11:23:11.448 V/FA-SVC ( 784): gmp_app_id: 1:450847066500:android:80a026686cf10a8d
09-26 11:23:11.448 V/FA-SVC ( 784): app_id: com.gaadi.sfa.dev
09-26 11:23:11.448 V/FA-SVC ( 784): app_version: 1.0.0.7
09-26 11:23:11.448 V/FA-SVC ( 784): app_version_major: 100007
09-26 11:23:11.448 V/FA-SVC ( 784): firebase_instance_id: e5ssFe0UGMY
09-26 11:23:11.448 V/FA-SVC ( 784): dev_cert_hash: -6222367415306193050
09-26 11:23:11.448 V/FA-SVC ( 784): app_store: manual_install
09-26 11:23:11.448 V/FA-SVC ( 784): upload_timestamp_millis: 1474869191396
09-26 11:23:11.448 V/FA-SVC ( 784): start_timestamp_millis: 1474869164947
09-26 11:23:11.448 V/FA-SVC ( 784): end_timestamp_millis: 1474869175184
09-26 11:23:11.448 V/FA-SVC ( 784): previous_bundle_start_timestamp_millis: 1474832497931
09-26 11:23:11.448 V/FA-SVC ( 784): previous_bundle_end_timestamp_millis: 1474832497931
09-26 11:23:11.448 V/FA-SVC ( 784): app_instance_id: 46bff6a9cfdd41f9c57bb94ff2a22a0a
09-26 11:23:11.448 V/FA-SVC ( 784): resettable_device_id: 7380f339-aa10-4513-a294-3a11d3048df6
09-26 11:23:11.448 V/FA-SVC ( 784): limited_ad_tracking: false
09-26 11:23:11.448 V/FA-SVC ( 784): os_version: 6.0.1
09-26 11:23:11.448 V/FA-SVC ( 784): device_model: MotoG3
09-26 11:23:11.448 V/FA-SVC ( 784): user_default_language: en-in
09-26 11:23:11.448 V/FA-SVC ( 784): time_zone_offset_minutes: 330
09-26 11:23:11.448 V/FA-SVC ( 784): bundle_sequential_index: 29
09-26 11:23:11.448 V/FA-SVC ( 784): service_upload: true
09-26 11:23:11.448 V/FA-SVC ( 784): user_property {
09-26 11:23:11.448 V/FA-SVC ( 784): set_timestamp_millis: 1474610827551
09-26 11:23:11.448 V/FA-SVC ( 784): name: _fot
09-26 11:23:11.448 V/FA-SVC ( 784): int_value: 1474614000000
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): user_property {
09-26 11:23:11.448 V/FA-SVC ( 784): set_timestamp_millis: 1474832490868
09-26 11:23:11.448 V/FA-SVC ( 784): name: LandingDboard
09-26 11:23:11.448 V/FA-SVC ( 784): string_value: LandingDboard opened
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): event {
09-26 11:23:11.448 V/FA-SVC ( 784): name: select_content
09-26 11:23:11.448 V/FA-SVC ( 784): timestamp_millis: 1474869164947
09-26 11:23:11.448 V/FA-SVC ( 784): previous_timestamp_millis: 1474832486501
09-26 11:23:11.448 V/FA-SVC ( 784): param {
09-26 11:23:11.448 V/FA-SVC ( 784): name: item_name
09-26 11:23:11.448 V/FA-SVC ( 784): string_value: Splash screen opened
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): param {
09-26 11:23:11.448 V/FA-SVC ( 784): name: _o
09-26 11:23:11.448 V/FA-SVC ( 784): string_value: app
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): param {
09-26 11:23:11.448 V/FA-SVC ( 784): name: item_id
09-26 11:23:11.448 V/FA-SVC ( 784): int_value: 7
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): event {
09-26 11:23:11.448 V/FA-SVC ( 784): name: _s
09-26 11:23:11.448 V/FA-SVC ( 784): timestamp_millis: 1474869175184
09-26 11:23:11.448 V/FA-SVC ( 784): previous_timestamp_millis: 1474830293753
09-26 11:23:11.448 V/FA-SVC ( 784): param {
09-26 11:23:11.448 V/FA-SVC ( 784): name: _o
09-26 11:23:11.448 V/FA-SVC ( 784): string_value: auto
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.448 V/FA-SVC ( 784): }
09-26 11:23:11.551 V/FA-SVC ( 784): Successfully fetched config. Got network response. code, size: 304, 0
09-26 11:23:11.552 V/FA-SVC ( 784): Uploading data. size: 454
09-26 11:23:11.554 W/FA-SVC ( 784): Uploading requested multiple times
09-26 11:23:12.097 V/FA-SVC ( 784): Upload scheduled in approximately ms: 3599996
09-26 11:23:12.100 V/FA-SVC ( 784): Successful upload. Got network response. code, size: 204, 0
09-26 11:25:33.029 V/FA ( 5784): Activity paused, time: 3451512963
09-26 11:25:33.037 V/FA ( 5784): onActivityCreated
09-26 11:25:33.288 D/FA ( 5784): Setting user property (FE): LandingDboard, LandingDboard opened
09-26 11:25:33.289 V/FA ( 5784): Using measurement service
09-26 11:25:33.289 V/FA ( 5784): Connecting to remote service
09-26 11:25:33.318 V/FA ( 5784): Activity resumed, time: 3451513253
09-26 11:25:33.586 D/FA ( 5784): Connected to remote service
09-26 11:25:33.587 V/FA ( 5784): Processing queued up service tasks: 1
09-26 11:25:33.591 D/FA-SVC ( 784): Setting user property: LandingDboard, LandingDboard opened
09-26 11:25:33.611 D/FA-SVC ( 784): User property set: LandingDboard, LandingDboard opened
09-26 11:25:38.594 V/FA ( 5784): Inactivity, disconnecting from AppMeasurementService
由于我的日志成功上传,我认为我没有像这样的Manifest Merger问题(如果我错了,请纠正我): FirebaseApp with name [DEFAULT] doesn't exist
我已经制作了一个演示项目并且工作正常。但是,当我在预先存在的项目中做同样的事情时,它就无法正常工作。
以下是我在Splash活动中的Google Analytics代码 -
firebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, 7);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Splash screen opened");
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
firebaseAnalytics.setAnalyticsCollectionEnabled(true);
我正在使用firebase-analytics-9.0.0
(同样适用于演示项目及其完美运行)
我甚至尝试在控制台的Firebase项目设置中添加可选的SHA1密钥,但没有成功。
PS - 我的崩溃数据完全显示在同一个项目中,但没有运气分析。