安卓编译错误Android Gradle plugin requires Java 11 to run?
错误信息:
* What went wrong:A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/jre
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`.
但是,我已经设置为11了,图中2种方式的11都试过了,再编译还是报错
回答:
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
你运行一下java -version 看看,你机器上的JAVA到底是什么版本的
回答:
提示信息相当明显,挨个排查
- changing the IDE settings.- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
本文参与了SegmentFault 思否面试闯关挑战赛,欢迎正在阅读的你也加入。
回答:
Settings -> Build tools > gradle 里面还有个设置 jdk的,你把里面的都设置好再试试
以上是 安卓编译错误Android Gradle plugin requires Java 11 to run? 的全部内容, 来源链接: utcz.com/p/945079.html