Skip to content

Unknown Kotlin JVM target: 21 #1217

@hatemragab

Description

@hatemragab

Version

3.6.0

Platforms

Android

Device Model

android 14 tablet

flutter info

[✓] Flutter (Channel stable, 3.24.4, on macOS 15.0.1 24A348 darwin-arm64 (Rosetta), locale en-EG)
    • Flutter version 3.24.4 on channel stable at /Users/hatemragap/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (7 days ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/hatemragap/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 242.21829.3

[✓] VS Code (version 1.95.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.100.0

[✓] Connected device (5 available)            
    • 23043RP34G (mobile)             • 44458219                  • android-arm64  • Android 14 (API 34)
    • iPhone (mobile)                 • 00008110-000864660183401E • ios            • iOS 18.1 22B83
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 15.0.1 24A348 darwin-arm64 (Rosetta)
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 15.0.1 24A348 darwin-arm64 (Rosetta)
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 130.0.6723.70

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

• No issues found!

How to reproduce?

I found i bug while just create new empty flutter project run on flutter 3.24.4
`
Could not determine the dependencies of task ':photo_manager:compileDebugKotlin'.

Unknown Kotlin JVM target: 21
i have recently upgrade android stuido to vAndroid Studio Ladybug | 2024.2.1 Patch 1and upgrade the gradle to this is the settings.gradle file
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.4" apply false
id "org.jetbrains.kotlin.android" version "1.9.10" apply false
}
and for build.gradle file is
android {
namespace = "com.example.untitled2"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId = "com.example.untitled2"
    // You can update the following values to match your application needs.
    // For more information, see: https://flutter.dev/to/review-gradle-config.
    minSdk = 23
    targetSdk = flutter.targetSdkVersion
    versionCode = flutter.versionCode
    versionName = flutter.versionName
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig = signingConfigs.debug
    }
}

}
`

Logs

Launching lib/main.dart on 23043RP34G in debug mode...
Running Gradle task 'assembleProdDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':photo_manager: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.org.

BUILD FAILED in 3s
Error: Gradle task assembleProdDebug failed with exit code 1

Example code (optional)

No response

Contact

[email protected]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions