java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.adi.fragment2/com.example.adi.fragment2.MainActivity}: java.lang.ClassCastException: com.example.adi.fragment2.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

,

Create an empty public constructor in your code.

Solutions on the web

via Stack Overflow by hamster
, 11 months ago
Unable to instantiate activity ComponentInfo{com.example.adi.fragment2/com.example.adi.fragment2.MainActivity}: java.lang.ClassCastException: com.example.adi.fragment2.MainActivity cannot be cast to android.app.Activity
via GitHub by thunter1000
, 1 year ago
Unable to instantiate activity ComponentInfo{com.flaredown.flaredownApp.DEBUG/com.flaredown.flaredownApp.Checkin.CheckinFragment}: java.lang.ClassCastException: com.flaredown.flaredownApp.Checkin.CheckinFragment cannot be cast to android.app.Activity
via Stack Overflow by Hoo
, 2 years ago
Unable to instantiate activity ComponentInfo{com.example.project.project/com.example.project.project.Claims}: java.lang.ClassCastException: com.example.project.project.Claims cannot be cast to android.app.Activity
via Stack Overflow by Pagar
, 5 months ago
Unable to instantiate activity ComponentInfo{com.local.broadcast_receiver/com.local.broadcast_receiver.MainActivity}: java.lang.ClassCastException: com.local.broadcast_receiver.MainActivity cannot be cast to android.app.Activity
via Stack Overflow by Nikolai
, 2 years ago
Unable to instantiate activity ComponentInfo{htgroup.welcome.voiceapp/htgroup.welcome.voiceapp.MainActivity}: java.lang.ClassCastException: htgroup.welcome.voiceapp.MainActivity cannot be cast to android.app.Activity
via Stack Overflow by Mahesh N
, 11 months ago
Unable to instantiate activity ComponentInfo{com.example.android.googleplaceswebservice/com.example.android.googleplaceswebservice.GooglePlaces}: java.lang.ClassCastException: com.example.android.googleplaceswebservice.GooglePlaces cannot be cast to android.app.Activity
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.adi.fragment2/com.example.adi.fragment2.MainActivity}: java.lang.ClassCastException: com.example.adi.fragment2.MainActivity cannot be cast to android.app.Activity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2548)

Users with the same issue

Once, 1 month ago
33 times, 2 months ago
8 times, 2 months ago
468 times, 3 months ago
65 times, 5 months ago

Write tip

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