The error is the following:
e: /Users/Houssame/.gradle/aches/transforms-3/e5c5aa35234c44d5264fd87af440dbf9/transformed/fragment-1.7.1-api.jar!/META-INF/fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
[!] Your project requires a newer version of the Kotlin Gradle plugin.Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update the │
version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of
/Users/Houssame/Desktop/demo 3/android/settings.gradle.
Alternatively (if your project was created before Flutter 3.19), update
/Users/Houssame/Desktop/demo 3/android/build.gradle
ext.kotlin_version = ”
I did upgrade all the version for Gradle but I have the same error, the app is ruining normally in emulator Android Studio.
Android/build.gradle
buildscript {
ext.kotlin_version = ‘2.0.20’
repositories {
google()
mavenCentral()
}dependencies {
classpath ‘com.android.tools.build:gradle:7.4.1’
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath ‘com.google.gms:google-services:4.4.2’
}
}allprojects {
repositories {
google()
mavenCentral()
}
}rootProject.buildDir = ‘../build’
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(‘:app’)
}tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Android/app/build.gradle
plugins {
id "com.android.application"
id ‘com.google.gms.google-services’
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.Inventory.App"
compileSdk = 34
ndkVersion = flutter.ndkVersioncompileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}kotlinOptions {
jvmTarget = ‘1.8’
}defaultConfig {
applicationId = "com.Inventory.App"
minSdk = 21
targetSdk = 34
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
}buildTypes {
release {
signingConfig = signingConfigs.debug
}
}
}flutter {
source = "../.."
}dependencies {
implementation ‘androidx.core:core:1.10.0’
implementation ‘androidx.appcompat:appcompat:1.6.1’
implementation ‘com.google.android.material:material:1.11.0’
}
Android/settings.gradle
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.google.gms.google-services" version "4.3.15" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}include ":app"
Thank you!
2
Answers
try
flutter clean
delete folder inside android/gradle
And try to build again. if didn’t worked try downgrading kotlin version to 1.7.10 or 1.8.0