Google Analytics service Intent crashes on Android Oreo

后端 未结 2 1505
予麋鹿
予麋鹿 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

    0 讨论(0)
  • 2021-01-17 09:24

    because CampaignTrackingService is now Deprecated

    just remove this line from your manifest

    <service android:name="com.google.android.gms.analytics.CampaignTrackingService"
             android:exported="true"/>
    
    0 讨论(0)
提交回复
热议问题