java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.xxxx/com.example.xxxx.MainActivity}: java.lang.ClassCastException: com.example.xxxx.MainActivity cannot be cast to android.app.Activity

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 Mark James
, 9 months ago
Unable to instantiate activity ComponentInfo{com.example.xxxx/com.example.xxxx.MainActivity}: java.lang.ClassCastException: com.example.xxxx.MainActivity cannot be cast to android.app.Activity
via Stack Overflow by Lechat Noir
, 1 year ago
Unable to instantiate activity ComponentInfo{ssip.ssip/ssip.ssip.DocumentationDef}: java.lang.ClassCastException: ssip.ssip.DocumentationDef cannot be cast to android.app.Activity
via Appcelerator JIRA by Ishan Singh, 9 months ago
Unable to start activity ComponentInfo{com.ishan.pushnotifications/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.HashMap
via Stack Overflow by user5425093
, 1 year ago
Unable to start activity ComponentInfo{tanav.sharma/tanav.sharma.TanavActivityOrder}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.String[]
via Stack Overflow by Sean Kurian
, 3 months ago
Unable to start activity ComponentInfo{com.example.sean.cookappreal/com.example.sean.cookappreal.LoginActivity}: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView
via GitHub by mvysny
, 11 months ago
Unable to start activity ComponentInfo{sk.baka.aedict3/sk.baka.aedict3.ConfigActivity}: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.xxxx/com.example.xxxx.MainActivity}: java.lang.ClassCastException: com.example.xxxx.MainActivity cannot be cast to android.app.Activity
at android.app.Instrumentation.newActivity(Instrumentation.java:1095)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3083)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Users with the same issue

21 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 2 years ago

Write tip

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