启动InstallReferrerService(TagManager)时发生IllegalStateException

时间:2018-09-21 12:00:48

标签: android google-analytics

我在Android 8上TagManager类崩溃时遇到问题。这是堆栈跟踪:

java.lang.RuntimeException: Unable to start receiver com.google.android.gms.tagmanager.InstallReferrerReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.x.z/com.google.android.gms.tagmanager.InstallReferrerService (has extras) }: app is in background uid UidRecord{90347cf u0a65 RCVR idle procs:1 seq(0,0,0)}
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:3399)
        at android.app.ActivityThread.-wrap18(ActivityThread.java:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6944)
        at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.x.z/com.google.android.gms.tagmanager.InstallReferrerService (has extras) }: app is in background uid UidRecord{90347cf u0a65 RCVR idle procs:1 seq(0,0,0)}

确保已连接到Android 8.0: java.lang.IllegalStateException: Not allowed to start service Intent,但看来我已经根据Google文档-https://developers.google.com/android/reference/com/google/android/gms/tagmanager/InstallReferrerReceiver

配置了InstallReferrer。
<service android:name="com.google.android.gms.tagmanager.InstallReferrerService"/>
<receiver
        android:name="com.google.android.gms.tagmanager.InstallReferrerReceiver"
        android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER"/>
    </intent-filter>
</receiver>

<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
          android:enabled="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER"/>
    </intent-filter>
</receiver>

<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
          android:enabled="true">
    <intent-filter>
        <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH"/>
    </intent-filter>
</receiver>

<service android:name="com.google.android.gms.analytics.AnalyticsService"
         android:enabled="true"
         android:exported="false"/>

我有仅Android 8.0和Samsung手机的崩溃报告。我使用com.google.android.gms:play-services-analytics:16.0.3

除删除InstallReferrerReceiver代码外,如何消除这些崩溃?

0 个答案:

没有答案