有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法启动接收器com。谷歌。安卓gms。gcm。GcmReceiver

当应用程序仅在版本>;=26 我使用的类扩展了GcmListenerService

这是我收到通知时的日志:

java.lang.RuntimeException: Unable to start receiver com.google.安卓.gms.gcm.GcmReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.安卓.c2dm.intent.RECEIVE flg=0x1000010 pkg=it.polymedia.adr_prod cmp=it.polymedia.adr_prod/com.hpe.adr.presentation.notifications.gcm.GCMPushReceiverService (has extras) }: app is in background uid UidRecord{280eacd u0a283 RCVR bg:+2m2s87ms idle procs:1 seq(0,0,0)}
    at 安卓.app.ActivityThread.handleReceiver(ActivityThread.java:3397)
    at 安卓.app.ActivityThread.-wrap18(Unknown Source:0)
    at 安卓.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
    at 安卓.os.Handler.dispatchMessage(Handler.java:105)
    at 安卓.os.Looper.loop(Looper.java:164)
    at 安卓.app.ActivityThread.main(ActivityThread.java:6938)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.安卓.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
 Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.安卓.c2dm.intent.RECEIVE flg=0x1000010 pkg=it.polymedia.adr_prod cmp=it.polymedia.adr_prod/com.hpe.adr.presentation.notifications.gcm.GCMPushReceiverService (has extras) }: app is in background uid UidRecord{280eacd u0a283 RCVR bg:+2m2s87ms idle procs:1 seq(0,0,0)}
    at 安卓.app.ContextImpl.startServiceCommon(ContextImpl.java:1538)
    at 安卓.app.ContextImpl.startService(ContextImpl.java:1484)
    at 安卓.content.ContextWrapper.startService(ContextWrapper.java:663)
    at 安卓.content.ContextWrapper.startService(ContextWrapper.java:663)
    at 安卓.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:91)
    at com.google.安卓.gms.gcm.GcmReceiver.doStartService(Unknown Source:23)
    at com.google.安卓.gms.gcm.GcmReceiver.zze(Unknown Source:0)
    at com.google.安卓.gms.gcm.GcmReceiver.onReceive(Unknown Source:106)
    at 安卓.app.ActivityThread.handleReceiver(ActivityThread.java:3390)
    at 安卓.app.ActivityThread.-wrap18(Unknown Source:0) 
    at 安卓.app.ActivityThread$H.handleMessage(ActivityThread.java:1780) 
    at 安卓.os.Handler.dispatchMessage(Handler.java:105) 
    at 安卓.os.Looper.loop(Looper.java:164) 
    at 安卓.app.ActivityThread.main(ActivityThread.java:6938) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.安卓.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 
    at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 
01-03 15:18:45.206 13281-13281/? E/Zygote: isWhitelistProcess - Process is Whitelisted

这是我的格拉德尔

compileSdkVersion 26
buildToolsVersion '26.0.3'

defaultConfig {
    applicationId "it.polymedia.adr"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 40300020
    versionName "4.3.2"
    multiDexEnabled true}

compile 'com.google.安卓.gms:play-services-gcm:9.6.1'

在切换到Firebase之前,是否有解决方法


共 (0) 个答案