From 88a61d9a52fe05015475bf106de4aeb7c788dfc0 Mon Sep 17 00:00:00 2001 From: JarvanMo Date: Tue, 19 Nov 2024 17:37:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7kotlin=E3=80=81gradle?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.gradle | 18 +++++++++--------- example/android/app/build.gradle | 9 +++++++++ .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/settings.gradle | 11 +++++------ 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 33f0d61a..b953060c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,16 +6,16 @@ version '1.0-SNAPSHOT' Map projectYaml = loadPubspec() buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.8.22' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath "org.yaml:snakeyaml:2.0" + classpath "com.android.tools.build:gradle:8.1.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.yaml:snakeyaml:2.0" } } @@ -36,12 +36,12 @@ android { compileSdk 34 compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = '17' } sourceSets { @@ -56,10 +56,10 @@ android { dependencies { api 'com.tencent.mm.opensdk:wechat-sdk-android:6.8.30' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0' implementation 'id.zelory:compressor:3.0.1' - implementation 'com.squareup.okhttp3:okhttp:4.10.0' + implementation 'com.squareup.okhttp3:okhttp:4.12.0' testImplementation 'org.jetbrains.kotlin:kotlin-test' testImplementation 'org.mockito:mockito-core:5.0.0' } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 773ce7f7..a41c36bf 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -61,6 +61,15 @@ android { storeFile file("debug.keystore") } } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = '17' + } } flutter { diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 3c472b99..7bb2df6b 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/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.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 7c21217c..db7675cc 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -5,10 +5,9 @@ pluginManagement { def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath - } - settings.ext.flutterSdkPath = flutterSdkPath() + }() - includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() @@ -19,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.1" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false } -include ":app" +include ":app" \ No newline at end of file