Finally, I updated my android/gradle.properties file with this line :
org.gradle.java.home=/opt/homebrew/opt/openjdk@17
This worked.