Be sure to check and correct JDK version in these 3 places:
- Check
Preferences -> Build,... -> Build Tools -> Gradle -> Gradle JVM:

- Check
Project Structure -> Project Settings -> Project -> Project SDK:

- Check
Project Structure -> Platform Settings -> SDKs:

Fixing gradle.properties is a dirty workaround. Better fix this at the IDE level.