Android开发Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.错误的解决方法
问题描述:
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`.
问题原因:
升级Android Gradle Plugin版本到7.x以上之后,要求项目使用jdk版本必须是11以上了,jdk1.8不行了,所以解决版本就算升级项目jdk版本到11以上
解决方法:
项目右键 --> Open Module Settings --> SDK Location --> Gradle Settings --> Gradle JDK --> Embedded JDk version 11选择Android Studio内置的jdk11即可(前提是Android Studio版本不能太低,要升级到2021.2.1以后最好是最新的稳定版本)