To everyone who has this problem, and have not found solution yet. First of all, you have to check for the compatibility of your Java version, and first Gradle version to support it, in: Gradle Compatibility Matrix.
Then you have to change the distributionUrl in: android/gradle/wrapper/gradle-wrapper.properties