Hi everyone, I'm getting the following error when...
# community-support
p
Hi everyone, I'm getting the following error whenever I try to build an APK in Flutter e: C:/Users/Dell/.gradle/caches/transforms-3/18814959c550d3ca7772edcaf8579634/transformed/jetified-kotlin-stdlib-1.9.24.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. Can anyone help me with error?
v
Kotlin is only forward-compatible one minor version. So when you use a Kotlin 1.7.x compiler you can use libraries that were built using Gradle 1.8.x, but not 1.9.x or newer. The error tells you that you are using Kotlin 1.7.1 to build your project but try to use a library that was compiled using Kotlin 1.9.0. So you either need to use an older version of that library or use a newer Kotlin version.
p
Hi, Thanks for answering me. I've updated the kotlin version and still I'm facing some issues here. please refer the screenshot and give any suggestions.
v
From the screenshot, I'd say you downgraded got Kotlin 1.6.0, not upgraded. 🤷‍♂️
p
but I changed ext.kotlin_version = '1.9.24'
just tell me where i can upgrade kotlin version. I'm totally confused
v
Actually, using
ext
for a local variable is an anti-pattern anyway. As well as using
buildscript { ... }
block to bring a plugin to the classpath. You should instead use the
plugins { ... }
block to apply plugins and not the legacy way with adding to
buildscript
dependencies and using
apply
. Where the version is coming from in your case I can hardly tell from just that snippet, I'd need to see the full build scripts.
Maybe you already add it to the classpath of a parent project build script which would then win over the classpath of a subproject build script.
p
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' } def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { namespace "com.example.niv" compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion 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.niv" // 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 flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } 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 signingConfig signingConfigs.release } } flavorDimensions "default" productFlavors { dev { resValue "string", "app_name", "Niv-dev" applicationIdSuffix ".dev" } stage { resValue "string", "app_name", "Niv-stage" applicationIdSuffix ".stage" } prod { resValue "string", "app_name", "Niv" } } } flutter { source '../..' } dependencies { }
this is my app>build.gradle
v
Actually, as your latest error was about artifact transforms, maybe now whatever does this artifact transformation is not compatible with Kotlin 1.8+? I'm not too familiar with Android or Flutter builds.