line / flutter_line_sdk

A Flutter plugin that lets developers access LINE's native SDKs in Flutter apps with Dart.
https://developers.line.biz/
Apache License 2.0
213 stars 42 forks source link

Execution failed for task ':flutter_line_sdk:compileDebugKotlin'. > Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17). #101

Closed RoshanGupta256 closed 2 months ago

RoshanGupta256 commented 4 months ago

I have added the package in my projects pubspec.yaml file and I am getting this error. I have tried flutter clean. and changed the kotlin version to the latest version too. Are there any other configuration required to use this package or am I making any mistakes?

onevcat commented 3 months ago

@YkSix Seems to be a version mismatching in Kotlin/Java. Do you have any idea on this?

YkSix commented 2 months ago

Hi @RoshanGupta256 , Thanks for reporting this issue. I couldn't reproduce this issue even after I changed my app/build.gradle to be like: (according to the current issue title)

compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '17'
}

To better understand the root cause and background of this issue, could you please provide the following information:

  1. Has this issue been resolved on your end? If yes, how did you resolve this issue?
  2. These settings in your project
    • the gradle version (in file: gradle-wrapper.properties)
    • versions of sourceCompatibility, targetCompatibility and jvmTarget
    • the Kotlin version
    • the Android Gradle Plugin version (com.android.tools.build:gradle)

Thanks.

RoshanGupta256 commented 2 months ago

Hello @YkSix Thank You for response. I have added the required informations below.

compileOptions { 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.eorder"
    // 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 24
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

signingConfigs {
    release {
       keyAlias keystoreProperties['keyAlias']
       keyPassword keystoreProperties['keyPassword']
       storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
       storePassword keystoreProperties['storePassword']
    }
}
buildTypes {
    release {
       signingConfig signingConfigs.release
    }
}

buildscript { ext.kotlin_version = '1.9.23'

dependencies {
    classpath 'com.android.tools.build:gradle:7.3.0'
    classpath 'com.google.gms:google-services:4.3.15'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

gradle.version=8.5

YkSix commented 2 months ago

@RoshanGupta256 , Thanks for your reply. I still couldn't reproduce the issue on my end. I created a sample app with the same configuration you mentioned. Could you please give it a try?

https://github.com/YkSix/flutter_line_sdk_mysample

Additionally, could you let me know which Java version you are using? Thanks.

$java --version
openjdk 17.0.9 2023-10-17
OpenJDK Runtime Environment GraalVM CE 17.0.9+9.1 (build 17.0.9+9-jvmci-23.0-b22)
OpenJDK 64-Bit Server VM GraalVM CE 17.0.9+9.1 (build 17.0.9+9-jvmci-23.0-b22, mixed mode, sharing)
onevcat commented 2 months ago

As #103 merged and the new 2.3.8 release, I guess we can close this issue.

Please feel free to reopen it if there is still issues on building with the compatible versions.