最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Upgrade Andriod Studio - can no longer build Flutter Android app - Stack Overflow

programmeradmin2浏览0评论

I've just updated Android Studio on my Windows 10 PC to Meerkat | 2024.3.1 and my Flutter app will no longer build for Android

When I try to compile in my IntelliJ IDE I'm getting the following Android build error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':assets_audio_player:compileDebugKotlin'.
> Unknown Kotlin JVM target: 21

* 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.
> Get more help at .

BUILD FAILED in 4m 17s
Error: Gradle task assembleDebug failed with exit code 1


Build #AI-243.22562.218.2431.13114758, built on February 25, 2025
Runtime version: 21.0.5+-12932927-b750.29 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 10.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4084M
Cores: 12
Registry:
  ide.experimental.ui=true
  i18n.locale=

The Flutter doctor -v output is...

[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.19045.5487], locale en-GB)
    • Flutter version 3.24.0 on channel stable at d:\Ian\Documents\sdk\flutter
    • Upstream repository .git
    • Framework revision 80c2e84975 (7 months ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\Ian\AppData\Local\Android\sdk
    • Platform android-34, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.8)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio Build Tools 2019 version 16.11.32002.261
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2024.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       
    • Dart plugin can be installed from:
       
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)

[√] IntelliJ IDEA Ultimate Edition (version 2024.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1
    • Flutter plugin version 83.0.4
    • Dart plugin version 243.23654.44

[√] Connected device (4 available)
    • SM S906B (mobile) • R3CTA09TLMK • android-arm64  • Android 14 (API 34)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.19045.5487]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 134.0.6998.89
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 133.0.3065.92

[√] Network resources
    • All expected network resources are available.

Any suggestions?

I've just updated Android Studio on my Windows 10 PC to Meerkat | 2024.3.1 and my Flutter app will no longer build for Android

When I try to compile in my IntelliJ IDE I'm getting the following Android build error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':assets_audio_player:compileDebugKotlin'.
> Unknown Kotlin JVM target: 21

* 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.
> Get more help at https://help.gradle..

BUILD FAILED in 4m 17s
Error: Gradle task assembleDebug failed with exit code 1


Build #AI-243.22562.218.2431.13114758, built on February 25, 2025
Runtime version: 21.0.5+-12932927-b750.29 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 10.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4084M
Cores: 12
Registry:
  ide.experimental.ui=true
  i18n.locale=

The Flutter doctor -v output is...

[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.19045.5487], locale en-GB)
    • Flutter version 3.24.0 on channel stable at d:\Ian\Documents\sdk\flutter
    • Upstream repository https://github/flutter/flutter.git
    • Framework revision 80c2e84975 (7 months ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\Ian\AppData\Local\Android\sdk
    • Platform android-34, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.8)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio Build Tools 2019 version 16.11.32002.261
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2024.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)

[√] IntelliJ IDEA Ultimate Edition (version 2024.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1
    • Flutter plugin version 83.0.4
    • Dart plugin version 243.23654.44

[√] Connected device (4 available)
    • SM S906B (mobile) • R3CTA09TLMK • android-arm64  • Android 14 (API 34)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.19045.5487]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 134.0.6998.89
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 133.0.3065.92

[√] Network resources
    • All expected network resources are available.

Any suggestions?

Share Improve this question asked Mar 11 at 12:40 user2868835user2868835 1,6605 gold badges24 silver badges54 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 0

I also had problems with Java 21.
Try downgrading to Java 17 to test.
These commands may be useful:

echo %JAVA_HOME%
java --version
flutter configure --jdk-dir YOUR_JDK_17

After downgrading to JDK 17, I also had to set the Gradle JDK to JAVA_HOME in Android Studio Meerkat under:

SettingsBuild, Execution, DeploymentBuild ToolsGradle

The problem was caused by a download and install of the latest Meerkat Andriod Studio.

Removing this, and installing the older Kiola version fixed the Flutter problem

发布评论

评论列表(0)

  1. 暂无评论