java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.admin.myapplication/com.example.admin.myapplication.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.example.admin.myapplication.ApplicationContext

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

Do you know how to solve this issue? Write a tip to help other users and build your expert profile.

Solutions on the web

via Stack Overflow by sumit
, 1 year ago
Unable to start activity ComponentInfo{com.example.admin.myapplication/com.example.admin.myapplication.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.example.admin.myapplication.ApplicationContext
via GitHub by leeight
, 1 year ago
Unable to start activity ComponentInfo{com.facebook.react.uiapp/com.facebook.react.uiapp.UIExplorerActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.facebook.react.ReactApplication
via Stack Overflow by simone_s1994
, 2 years ago
Unable to start activity ComponentInfo{com.simonesessa.count/com.simonesessa.count.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.simonesessa.count.MyApp
via Stack Overflow by userxx
, 2 years ago
Unable to start activity ComponentInfo{com.example.studygroup/com.example.studygroup.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.example.studygroup.MainActivity
via GitHub by devashishmamgain
, 2 years ago
Unable to start activity ComponentInfo{com.mobicomkit.sample/com.applozic.mobicomkit.uiwidgets.people.activity.MobiComKitPeopleActivity}: java.lang.ClassCastException: com.applozic.mobicomkit.uiwidgets.contacts.fragment.AppContactFragment cannot be cast to com.applozic.mobicomkit.uiwidgets.people.fragment.ContactsListFragment
via GitHub by thehijjt
, 1 year ago
Unable to start activity ComponentInfo{org.kegbot.app/org.kegbot.app.SettingsActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.admin.myapplication/com.example.admin.myapplication.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.example.admin.myapplication.ApplicationContext
at com.example.admin.myapplication.MainActivity.onCreate(MainActivity.java:70)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.