添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
老实的开心果  ·  javascript - ...·  1 年前    · 
帅气的夕阳  ·  LyScript ...·  1 年前    · 
难过的炒饭  ·  【C++教程】2.3 - ...·  2 年前    · 
37

posted at

updated at

Android Gradle plugin requires Java 11と言われてSyncできないときの対処法

AGP 7.0.0-alpha02からJava 11が必須になったようです。
https://developers-jp.googleblog.com/2020/12/announcing-android-gradle-plugin.html
あの設定どこだっけってときどきなって、かなり高確率で最初に当たるので、メモしておきます。

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

最近は以下のようなエラーメッセージでも同様のことが起こるようなので、対処方法を試してみてください。

  • Java 11にしかないパラメーターを使っているパターン
  • Unrecognized VM option 'MaxPermSize=2048m'

  • Toolchainで11を使っているパターン
  • A problem occurred configuring project ':app'.
    Could not determine the dependencies of task ':build-logic:compileKotlin'.
    No matching toolchains found for requested specification: {languageVersion=11, vendor=any, implementation=vendor-specific}.
    > No locally installed toolchains match (see https://docs.gradle.org/8.1.1/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.1.1/userguide/toolchains.html#sub:download_repositories).

    Gradleの設定を開いて、

    Android Studioに入っているJDKを選ぶだけです。

    Register as a new user and use Qiita more conveniently

    1. You get articles that match your needs
    2. You can efficiently read back useful information
    What you can do with signing up
    37