Hello Guys! Please, I get this Kotlin error when r...
# multiplatform
v
Hello Guys! Please, I get this Kotlin error when running my Flutter project
Copy code
Launching lib\main.dart on SM A315F in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':google_api_headers:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).

  Consider using JVM Toolchain: <https://kotl.in/gradle/jvm/toolchain>
  Learn more about JVM-target validation: <https://kotl.in/gradle/jvm/target-validation> 

* 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 1m 32s
Error: Gradle task assembleDebug failed with exit code 1
I really don't understand the documentation on the Kotlin's main page. This is my app\build.gradle file
Copy code
plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

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

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "com.example.vinedress_customer"
    compileSdk 34
    ndkVersion "26.3.11579264"

    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (<https://developer.android.com/studio/build/application-id.html>).
        applicationId "com.example.vinedress_customer"
        // You can update the following values to match your application needs.
        // For more information, see: <https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration>.
        minSdkVersion 21
        targetSdkVersion 34
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    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
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
    implementation 'com.android.support:multidex:1.0.3'
}
Please, I need help. Thank you!
🧵 3
p
v
I tried all their solutions but none worked for me. Thank you for the help though! ☺️
166 Views