it happened for me when I deleted the jdk and installed new one somehow the project kept seeing the old one as invalid but couldn’t change, so right click on your module -> Open Module Settings -> and choose Compile Sdk Version.
it happened for me when I deleted the jdk and installed new one somehow the project kept seeing the old one as invalid but couldn’t change, so right click on your module -> Open Module Settings -> and choose Compile Sdk Version.