From 489d87b65ecfdea619f7f88675d424ea3f4fa4d8 Mon Sep 17 00:00:00 2001 From: Makram Rhouma <87503624+Makram-BenRhouma-Dev@users.noreply.github.com> Date: Tue, 24 Jun 2025 16:11:36 +0000 Subject: [PATCH] Fix Gradle/Java compatibility issue - Update Gradle version from 7.6.3 to 8.4 to support Java 21 - Update Android Gradle Plugin from 7.3.0 to 8.1.4 - Update Kotlin version from 1.7.10 to 1.9.10 - Update Java compatibility from version 1.8 to 17 - Update Kotlin JVM target from '1.8' to '17' This resolves the 'Unsupported class file major version 65' error that occurs when using Java 21 with older Gradle versions. --- android/app/build.gradle | 6 +++--- android/gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index bfe7e8b8..4ecf8349 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,12 +28,12 @@ android { ndkVersion flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index e1ca574e..5e6b5427 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 1d6d19b7..2c195bce 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -19,8 +19,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.android.application" version "8.1.4" apply false + id "org.jetbrains.kotlin.android" version "1.9.10" apply false } include ":app"