Class cast exception android.app.ContextImpl when using with Firebase
See original GitHub issueThe Issue is during FCM integration
Exception java.lang.RuntimeException: Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver: java.lang.ClassCastException: uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper cannot be cast to android.app.ContextImpl
android.app.ActivityThread.handleReceiver (ActivityThread.java:2750)
android.app.ActivityThread.access$1800 (ActivityThread.java:154)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1431)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:5443)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:728)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)
arrow_drop_down
Caused by java.lang.ClassCastException: uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper cannot be cast to android.app.ContextImpl
When i comment the below ApplicationController code, it works fine
@Override
public void onCreate() {
super.onCreate();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/RobotoCondensedLight.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
}
@Override
protected void attachBaseContext(Context base) {
MultiDex.install(this);
super.attachBaseContext(CalligraphyContextWrapper.wrap(base));
}
FirebaseInstanceIdInternalReceiver is not created by me so i could’t manage the context there.
I tried solutions of your different lib at below url but didn’t found any solution https://github.com/mikepenz/Android-Iconics/issues/180
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
java.lang.ClassCastException: android.app.ContextImpl
... it shows that it casts the context to Activity . Try using this instead of getBaseContext , since you're calling from an...
Read more >Class cast exception android.app.ContextImpl when using ...
The Issue is during FCM integration. Exception java.lang.RuntimeException: Unable to start receiver com.google.firebase.iid.
Read more >android.app.ContextImpl cannot be cast to android ... - Lynxbee -
Solved: java.lang.ClassCastException: android.app.ContextImpl cannot be cast to android.app.Activity.
Read more >Android – Unable to start receiver com.google.firebase.iid ...
My app integrates FCM to receive push notifications and it works okay. However, I am facing issue that on installation it crashes randomly....
Read more >Android Question [SOLVED] App crashes after SDK update
It didn't specifically say that it fixes crashes related to the latest Firebase SDK, however I updated from v1.01 & it fixed the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@amitkaira87 see #211
Wrap the
Activity
Context:Activity NOT Application
We Deprecated this lib in favor of https://github.com/InflationX/Calligraphy about 3ish years ago. It’s a pretty easy migration.