diff --git a/android/app/build.gradle b/android/app/build.gradle index 5e5a7b9..28493ae 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,15 +1,17 @@ +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) + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -20,23 +22,24 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { + namespace "dev.birju.targetmate" compileSdkVersion 34 - ndkVersion flutter.ndkVersion + ndkVersion "25.1.8937393" compileOptions { // Flag to enable support for the new language APIs coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + + kotlin { + jvmToolchain(17) } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } sourceSets { @@ -47,7 +50,7 @@ android { applicationId "dev.birju.targetmate" // 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 + minSdkVersion 24 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -77,7 +80,6 @@ android { signingConfig signingConfigs.release } } - namespace 'dev.birju.targetmate' } flutter { @@ -86,9 +88,9 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' // for Android 12L - implementation 'androidx.window:window:1.0.0' - implementation 'androidx.window:window-java:1.0.0' + implementation 'androidx.window:window:1.2.0' + implementation 'androidx.window:window-java:1.2.0' } diff --git a/android/build.gradle b/android/build.gradle index 97a56a5..185cbd2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,13 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + buildscript { - ext.kotlin_version = '1.9.20' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.3.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -16,6 +17,11 @@ allprojects { google() mavenCentral() } + tasks.withType(KotlinCompile).configureEach { + kotlinOptions { + jvmTarget = "17" + } + } } rootProject.buildDir = '../build' @@ -29,3 +35,16 @@ subprojects { tasks.register("clean", Delete) { delete rootProject.buildDir } + +tasks.withType(KotlinCompile).configureEach { + kotlinOptions { + jvmTarget = "17" + } +} + +afterEvaluate { + tasks.withType(JavaCompile).configureEach { + sourceCompatibility = JavaVersion.VERSION_17.toString() + targetCompatibility = JavaVersion.VERSION_17.toString() + } +} \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties index b9a9a24..8ded02c 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -4,3 +4,5 @@ android.enableJetifier=true android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false android.nonFinalResIds=false +kotlin.jvm.target.validation.mode = IGNORE +org.gradle.warning.mode=all \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 5e6b542..3c85cfe 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-8.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 44e62bc..98b47cc 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,11 +1,30 @@ -include ':app' +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 + } + settings.ext.flutterSdkPath = flutterSdkPath() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" + plugins { + id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + id 'org.jetbrains.kotlin.android' version '1.9.10' + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version '8.5.1' apply false +} + +include ":app"