Skip to content

Commit aaf5852

Browse files
committed
chore: update Android Gradle build to support the newer Flutter SDK
- Upgraded Gradle to 8.12.1 - Changed compile and target compatibility to Java 17 with corresponding Kotlin JVM target - Set `compileSdkVersion` to use Flutter's value. - Added compiler flags for unchecked and deprecation warnings.
1 parent 53a0c2a commit aaf5852

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

android/build.gradle

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
group 'io.ably.flutter.plugin'
2-
version '1.0'
2+
// Use the snapshot suffix to show that build artifacts are not shared.
3+
// This Gradle file is used by Flutter to build itself.
4+
version '1.0-SNAPSHOT'
35

46
buildscript {
7+
ext.kotlin_version = '2.2.10'
58
repositories {
69
google()
7-
mavenCentral() // for firebase-messaging
10+
mavenCentral()
811
}
912

1013
dependencies {
11-
classpath 'com.android.tools.build:gradle:7.4.0'
14+
classpath 'com.android.tools.build:gradle:8.12.1'
15+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1216
}
1317
}
1418

@@ -33,22 +37,25 @@ dependencies {
3337
}
3438

3539
android {
36-
compileSdkVersion 34
40+
compileSdkVersion flutter.compileSdkVersion
3741

3842
// Conditional for compatibility with AGP <4.2.
3943
if (project.android.hasProperty("namespace")) {
4044
namespace 'io.ably.flutter.plugin'
4145
}
4246

43-
// Require Java language level 8 so we can use Method References (used with Lambdas)
4447
compileOptions {
45-
sourceCompatibility JavaVersion.VERSION_1_8
46-
targetCompatibility JavaVersion.VERSION_1_8
48+
sourceCompatibility = JavaVersion.VERSION_17
49+
targetCompatibility = JavaVersion.VERSION_17
4750

4851
// Flag to enable Java 8 language APIs while supporting to older SDK Versions
4952
coreLibraryDesugaringEnabled true
5053
}
5154

55+
kotlinOptions {
56+
jvmTarget = JavaVersion.VERSION_17.toString()
57+
}
58+
5259
defaultConfig {
5360
minSdkVersion 19
5461

@@ -66,4 +73,10 @@ android {
6673
}
6774
}
6875

76+
gradle.projectsEvaluated {
77+
tasks.withType(JavaCompile) {
78+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
79+
}
80+
}
81+
6982
apply from: file("./ably-agent.gradle")

0 commit comments

Comments
 (0)