**
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8
**
AGP 7.0.0-alpha02起需要使用Java 11
https://developers-jp.googleblog.com/2020/12/announcing-android-gradle-plugin.html
需要注意gradle的Java版本并非AndroidStudio工程依赖的Java版本。gradle的Java版本可以通过以下任一种方式进行配置:
方式1:通过IDE配置
AndroidStudio > File > Setting >File | Settings | Build, Execution, Deployment > Build Tools >Gradle
方式2:通过gradle.properties配置
gradle.properties文件中配置如下:
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home