当前位置:   article > 正文

android studio编译的时Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8_android gradle plugin requires java 17 to run. you

android gradle plugin requires java 17 to run. you are currently using java

背景

升级android studio 之后编译代码的时候遇到了下面的问题

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.
      Your current JDK is located in /Library/Java/JavaVirtualMachines/jdk1.8.0_91.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`.

* 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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

修改方法

修改工程的配置:

  1. 找到preferences 中的build tools gradle的配置, 里面有项配置是gradle jdk的配置
    在这里插入图片描述
  2. 将版本从1.8改成android studio 自带的jdk 11 版本
    在这里插入图片描述
  3. 重新编译,问题就消除了
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/774689
推荐阅读
相关标签
  

闽ICP备14008679号