FCM : Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver:


App is crashing while receiving push notification in Oreo(8.0) only .

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)


I was facing the same issue when using Calligraphy library. Even it was crashing the first time after installing when Firebase requests a token for the first time. Not only receiving push notifications.

My error was I was overriding attachBaseContext method in my Application class to return a ContextWrapper object, but was only needed in Activities.

So to resume my solution is to remove attachBaseContext in Application class and move it or just place it into activities.


  • NullPointerException in CookieSyncManager.createInstance in AsyncTask
  • Coffeescript dynamically create/call a function from a list on select box value change
  • Visual Studio 2008 Publish fails, can't load dll (envdte.dll)
  • FCM : Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver:
  • Convert datetime to MM yyyy, dd using lambda expression [closed]
  • Suddenly my create new project is error in android
  • Retrieving the component name of a service defined in another Xamarin application
  • SSIS Script Component runtime error
  • How to create a view with 14000 Columns in it?
  • GCM client does not receive downstream messages
  • handle special characters in PL/SQL procedures.?
  • How can I loop inside an Update statement?
  • Download images and save it
  • Hosting PreviewHandlers on x64 gives REGDB_E_CLASSNOTREG
  • How can I get the nearest rows in mysql?
  • What is “SQLiteDatabase created and never closed” error?
  • CodenameOne - Android app fails to start when building with android.buildToolsVersion=27
  • How to download apk in internal storage from URL then install automatically in android?
  • Android: How to close a cursor that returns from Class to Activity
  • Google Bar Chart custom tooltip does not work
  • tree algorithm implementation c#
  • VB.NET: How do I use coalesce with db column values and nullable types? Or is there a better solutio
  • Jooq casting String to BigDecimal
  • Null ImageView Reference
  • RavenDB indexing errors
  • Multiple Left Join LINQ-to-entities
  • Suqueries in select clause with JPA
  • Default parameter as generic type
  • Android app gives error “BatteryStatsImpl: reading network stats”
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • Disable Enter in editText android
  • Cannot resolve symbol 'MyApi'
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Align navbar back button on right side
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • Release, debug version and Authorization Google?
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Load html files in TinyMce
  • Free memory of cv::Mat loaded using FileStorage API