Invalid Gradle JDK configuration found. Open Gradle Settings Use JDK from project structure code example
Example: android studio invalid gradle jdk configuration found. open gradle settings use jdk from project structure
Delete these generated files:
.idea/gradle.xml
.idea/workspace.xml
then click try again to sync the project.