Skip to content

最新版 Android Studio (Ladybug | 2024.2.1 Patch 2),无法运行 Android 示例 #4

@SageMik

Description

@SageMik

Android Studio Ladybug 将内置的 JDK 升级到了 21 版本,

Flutter 运行 Android 程序时会使用内置的 JDK 21 导致项目无法兼容而报错,解决方案:

  1. 修改 JAVA_HOME 为 JDK 17(未验证);
  2. 调用 Flutter 运行配置,添加--jdk-dir path/to/jdk-17(未验证);
  3. Android Studio 直接打开 example/android,修改设置 Build, Execution, Deployment > Build Tools > Gradle - Gradle JDK 为 17;
  4. 修改 Android build.gradle 配置:Android plugins: Failed to transform core-for-system-modules.jar to match attributes errors with JDK 21 flutter/flutter#156304 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions