【发布时间】:2018-05-17 13:27:45
【问题描述】:
仅在 Oreo(8.0) 中接收推送通知时应用崩溃。
java.lang.RuntimeException: Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.ClassCastException: android.content.ContextWrapper cannot be cast to android.app.ContextImpl
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3236)
at android.app.ActivityThread.-wrap17(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
【问题讨论】:
-
如果您不在代码中显示崩溃发生的位置,几乎不可能回答您的问题。
-
我只得到上面的异常,代码中没有错误/异常。由于崩溃仅在收到通知时出现在 oreo 8 版本中,因此我怀疑以下行。 String refreshedToken = FirebaseInstanceId.getInstance().getToken();
标签: android firebase firebase-cloud-messaging android-8.0-oreo