简体   繁体   中英

Firebase analytics with Google Play Services outdated

I am migrating my app from using Google Analytics to Google Analytics for Firebase.

I setup a Firebase project like explained in the tutorial https://firebase.google.com/docs/android/setup . Then I setup Analytics like this: https://firebase.google.com/docs/analytics/android/start/

I enalbed looging using:

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

And with the following command I am trying to see the events in the DebugView ( https://support.google.com/firebase/answer/7201382?hl=en&utm_id=ad&authuser=0 ):

adb shell setprop debug.firebase.analytics.app com.myapp.mypackage

All builds and compile but when I run the app in the device and I see the following logs:

09-17 20:32:48.248 21705-21751/com.myapp.mypackage I/FirebaseInitProvider: FirebaseApp initialization successful
09-17 20:32:48.318 21705-21751/com.myapp.mypackage I/FA: App measurement is starting up, version: 18202
09-17 20:32:48.318 21705-21751/com.myapp.mypackage I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-17 20:32:48.318 21705-21751/com.myapp.mypackage I/FA: Faster debug mode event logging enabled. To disable, run:
      adb shell setprop debug.firebase.analytics.app .none.
09-17 20:32:48.328 21705-21751/com.myapp.mypackage D/FA: Debug-level message logging enabled
09-17 20:32:48.548 21705-21763/com.myapp.mypackage I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtilLight.isUninstalledAppPossiblyUpdating
09-17 20:32:48.568 21705-21763/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:32:48.648 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:32:48.658 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: setUserProperty: upKey: BuildType -> upValue: debug
09-17 20:32:48.668 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: setUserProperty: upKey: AppAnalyticsVersion -> upValue: 2.0
09-17 20:32:48.788 21705-21751/com.myapp.mypackage D/FA: Setting user property (FE): BuildType, debug
09-17 20:32:49.018 21705-21751/com.myapp.mypackage D/FA: Setting user property (FE): AppAnalyticsVersion, 2.0
09-17 20:32:49.668 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:49.678 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send app launch
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Failed to get app instance id
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to set user attribute
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to set user attribute
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to set user attribute
09-17 20:32:49.878 21705-21751/com.myapp.mypackage I/FA: Tag Manager is not found and thus will not be used
09-17 20:32:50.138 21705-21751/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_screen_class(_sc)=AppBootActivity, ga_screen_id(_si)=3005854567277075178}]
09-17 20:32:50.288 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:32:50.288 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:50.298 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:32:50.308 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:50.318 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:32:50.318 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:32:50.318 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:32:54.668 21705-21751/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=AppBootActivity, ga_previous_id(_pi)=3005854567277075178, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179}]
09-17 20:32:54.768 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:32:56.948 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:56.958 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:32:56.958 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:32:56.968 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:33:19.048 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:33:19.138 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:33:19.148 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:33:22.708 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: logEvent: eventName: Screen_Launcher -> infoBundle: Bundle[{action=Expand, label=temperatures}]
09-17 20:33:22.768 21705-21751/com.myapp.mypackage D/FA: Logging event (FE): Screen_Launcher, Bundle[{action=Expand, ga_event_origin(_o)=app, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179, label=temperatures}]
09-17 20:33:22.818 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:33:22.908 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:33:22.918 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:38:22.738 21705-23662/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:38:22.778 21705-23662/com.myapp.mypackage D/FA: Logging event (FE): user_engagement(_e), Bundle[{ga_event_origin(_o)=auto, engagement_time_msec(_et)=303709, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179}]
09-17 20:38:22.798 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:38:23.118 21705-23662/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:38:23.128 21705-23662/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:38:23.128 21705-23662/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:38:23.158 21705-23662/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=ScreenLauncherActivity, ga_previous_id(_pi)=3005854567277075179, ga_screen_class(_sc)=ScreenSaverActivity, ga_screen_id(_si)=3005854567277075180}]
09-17 20:38:23.178 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:38:23.208 21705-23662/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:38:23.218 21705-23662/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:38:23.218 21705-23662/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:38:23.258 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:39:08.618 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: logEvent: eventName: Standby -> infoBundle: Bundle[{action=Click, label=Standby}]
09-17 20:39:08.668 21705-23896/com.myapp.mypackage D/FA: Logging event (FE): Standby, Bundle[{action=Click, ga_event_origin(_o)=app, ga_screen_class(_sc)=ScreenSaverActivity, ga_screen_id(_si)=3005854567277075180, label=Standby}]
09-17 20:39:08.728 21705-23896/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:39:08.808 21705-23896/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=ScreenSaverActivity, ga_previous_id(_pi)=3005854567277075180, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179}]
09-17 20:39:08.848 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:39:08.878 21705-23896/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 4325038
09-17 20:39:08.898 21705-23896/com.myapp.mypackage D/FA: Logging event (FE): user_engagement(_e), Bundle[{ga_event_origin(_o)=auto, engagement_time_msec(_et)=45904, ga_screen_class(_sc)=ScreenSaverActivity, ga_screen_id(_si)=3005854567277075180}]
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:39:09.178 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}

And there are no events in the DebugView of the Firebase console.

Each time I perform an action to log an event, it complains about Google Play Services.

The devices where the app runs is not deployed into the Play Store so it may have Google Play Services outdated, or even non-existent, and we don't want to force our users to update/install it.

From the logs, it seems FirebaseApp initialization is successful, but then the is a log saying Failed to get app instance id ...

I did some research and in some cases I see that Firebase Analytics require Google Play Services updated ( https://stackoverflow.com/a/37426991/1204249 ) but in some others, it looks it should work:

My questions are:

  • can I use Firebase Analytics without Google Play services or with an outdated version?
  • if yes, what could be the problem? Some configuration?

I ended up making it work, but not sure which of the following changes did the trick.

Changes made:

  • In Firebase console, in Project settings > General, I added the SHA certificate fingerprint, which wasn't there before: 在此处输入图片说明
  • Downloaded the new google-services.json, replaced it in the project and added the following keys in "services": 在此处输入图片说明
  • Removed <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> form the AndroidManifest.xml

Also, even having the previous points in as described, sometimes I could get these errors on my development device... After spending some time on it, I erased the application data from the system settings and it start sending the events again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM