[FIXED] FragmentActivity which is a supertype of MainActivity can not be accessed

Issue

When I wanna create a new project in AS I get this error:

Cannot access ‘androidx.fragment.app.FragmentActivity’ which is a supertype of ‘com.example.test123.MainActivity’. Check your module classpath for missing or conflicting dependencies

After that I can not build/rebuild or run my clean new project.
any idea?

Solution

i got the same issue with my gradle and project build/rebuild,
the solution however is somehow random but i tried to remove the contents of my ".gradle" folder to force my project to download it from scratch.

After doing that in the AS i changed the gradle plugin version to a latest release (ex. alpha x.xx) in File -> Project Structure and rebuild project
and then again reverted back to latest stable release and my project built without any issue.

Answered By – Hooman Abedi

Answer Checked By – Marilyn (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published