1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Unknown Kotlin JVM Target: 21 - Flutter Build Error in Beginner Project

Discussão em 'Mobile' iniciado por Stack, Outubro 4, 2024 às 06:42.

  1. Stack

    Stack Membro Participativo

    I'm a beginner in Flutter app development and I'm encountering an error while trying to build an APK using flutter build apk. The error message mentions an "Unknown Kotlin JVM target: 21" within the nb_utils module.

    Here's what I've tried so far:

    I've changed my Java SDK version to Java 11. The full error message is:

    FAILURE: Build failed with an exception.

    • What went wrong: Could not determine the dependencies of task ':nb_utils:compileReleaseKotlin'.

    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 1s Running Gradle task 'assembleRelease'... 1,620ms Gradle task assembleRelease failed with exit code 1

    my build.gradle

    plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    }

    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
    localProperties.load(reader)
    }
    }

    android {
    compileSdkVersion 34

    sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
    disable 'InvalidPackage'
    }

    defaultConfig {
    applicationId "com.mighty.web"
    minSdkVersion 22
    targetSdkVersion 34
    versionCode 36
    versionName "5.0.2"
    multiDexEnabled true
    }

    buildTypes {
    release {
    minifyEnabled false
    shrinkResources false
    signingConfig signingConfigs.debug
    }
    }

    googleServices { disableVersionCheck = true }

    }

    flutter {
    source '../..'
    }
    allprojects {
    /// TODO: remove. hotfix for flutter_inappwebview (using androidx.webkit:webkit:1.8.0)
    /// webview_flutter_android: ^3.16.2 androidx.webkit:webkit ^1.9.0 remove SUPPRESS_ERROR_PAGE
    configurations.all {
    resolutionStrategy {
    force 'androidx.webkit:webkit:1.8.0'
    }
    }
    }

    dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0"
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.firebase:firebase-analytics:21.2.2'
    implementation 'com.google.android.gms:play-services-basement:18.2.0'
    }

    Continue reading...

Compartilhe esta Página