If you encounter this error, you might want to open the idea project settings with Ctrl+Alt+S, search for 'gradle' and ensure that the JVM version selected for gradle is the same as the project version.