Powered By:
Android Advice
 

Solution to Error java.lang.ClassCastException: android.app.Application cannot be cast

Problem
When attempting to cast an Android application object to another type you get the error “Solution to Error java.lang.ClassCastException: android.app.Application cannot be cast …”
Cause
1. The type being casted to does not extend the type Application
2. The type has not been defined in the Android manifest
Solution
See the article on how to correctly setup a custom Android Application Class here: http://www.stevenmarkford.com/hook-into-android-application-start-event-oncreate-extending-the-application-class/

Leave a Comment

Notify via Email Only if someone replies to My Comment