It was no need to downgrade Java JDK.
Just changed gradle version in gradle-wrapper properties
to 7.1.1 (6.x does not support java 16), and adding the following
line in gradle.properties:
'org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED'
Taken from: https://stackoverflow.com/a/69179997