Home > Back-end >  FragmentActivity which is a supertype of MainActivity can not be accessed
FragmentActivity which is a supertype of MainActivity can not be accessed

Time:11-29

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? Thanks in advance.

CodePudding user response:

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.

CodePudding user response:

Check if you have the appcompat library in the app's build.gradle file. If it's still not working, try to invalidate caches and restart.

  • Related