Google Analytics service Intent crashes on Android Oreo

后端 未结 2 1507
予麋鹿
予麋鹿 2021-01-17 09:04

I have upgraded my app to support SDK 26 and now Google Analytics causes crashes when running on Android Oreo:

Fatal Exception: java.lang.RuntimeExcep

2条回答
  •  礼貌的吻别
    2021-01-17 09:22

    I recommend upgrading to play-services version 11.4.0. Add this in your Gradle file:

    compile "com.google.android.gms:play-services-analytics:11.4.0
    

    From the Play Services Revision 11.4.0, analytics section:

    • Added a new class AnalyticsJobService. This class provides compatibility support for Android O and is used by Analytics to upload data. No action is necessary to use this class, it’s added automatically as part of the Analytics package.
    • Deprecated the getContext() method of the AnalyticsService class.
    • Deprecated the CampaignTrackingService class.

    and also you have to get permission. android:permission="android.permission.BIND_JOB_SERVICE"

    See below https://developers.google.com/android/reference/com/google/android/gms/analytics/AnalyticsJobService

提交回复
热议问题