1. List all Java version information /usr/libexec/java_home -V 2.modify .zshrc file vi ~/zshrc 3.add java_home export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home #jdk安装路径 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 3.refresh config file source ~/.zshrc 4.check java_home virable javs -version 5.The flutter project is looking for Android studio jdk by default even if JAVA_HOME is configured, so you need to modify the gradle.properties of the studio vi gradle.properties 6.add config info og.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home