Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
报错如下:
Build file 'D:\torey\projectTest\androidProjectTest\firstApp3\app\build.gradle' line: 2
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
原因:
原因是:gradle版本太高了,可以将gradle版本降低,或者将jdk1.8升级为jdk11
解决方式有两种:
方式1: 将Gradlejdk 由原来的jdk1.8 修改为jdk11
方式2: 将gradle的版本降级
找到项目中的build.gradle文件,修改如下:
|