Skip to content

Commit 63c86ab

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 - Set `compileSdkVersion` to use Flutter's value. - Added compiler flags for unchecked and deprecation warnings.
1 parent 53a0c2a commit 63c86ab

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

android/build.gradle

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
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 {
57
repositories {
68
google()
7-
mavenCentral() // for firebase-messaging
9+
mavenCentral()
810
}
911

1012
dependencies {
11-
classpath 'com.android.tools.build:gradle:7.4.0'
13+
classpath 'com.android.tools.build:gradle:8.12.1'
1214
}
1315
}
1416

@@ -33,17 +35,16 @@ dependencies {
3335
}
3436

3537
android {
36-
compileSdkVersion 34
38+
compileSdkVersion flutter.compileSdkVersion
3739

3840
// Conditional for compatibility with AGP <4.2.
3941
if (project.android.hasProperty("namespace")) {
4042
namespace 'io.ably.flutter.plugin'
4143
}
4244

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

4849
// Flag to enable Java 8 language APIs while supporting to older SDK Versions
4950
coreLibraryDesugaringEnabled true
@@ -66,4 +67,10 @@ android {
6667
}
6768
}
6869

70+
gradle.projectsEvaluated {
71+
tasks.withType(JavaCompile) {
72+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
73+
}
74+
}
75+
6976
apply from: file("./ably-agent.gradle")

example/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pluginManagement {
1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
2121
id "com.android.application" version "8.7.0" apply false
22-
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
22+
id "org.jetbrains.kotlin.android" version "2.2.20" apply false
2323
id "com.google.gms.google-services" version "4.3.10" apply false
2424
}
2525

test_integration/android/settings.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "7.4.0" apply false
22-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
21+
id "com.android.application" version "8.7.0" apply false
22+
id "org.jetbrains.kotlin.android" version "2.2.20" apply false
23+
id "com.google.gms.google-services" version "4.3.10" apply false
2324
}
2425

2526
include ":app"

0 commit comments

Comments
 (0)