You should set your project JDK version as 17.
You can find the settings inside And. Studio Settings under Build,Execution,Deployment / Gradle / Gradle Projects