Skip to content

Commit 13d991e

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 13d991e

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

.github/workflows/flutter_integration.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
device: # Device names must be shown in `xcrun simctl list devices`
13-
- 'iPhone 15' # we are not specifying the iOS version as it tends to change
13+
- 'iPhone 16' # we are not specifying the iOS version as it tends to change
1414
fail-fast: false
1515
runs-on: macos-latest
1616
steps:
@@ -33,7 +33,10 @@ jobs:
3333
timeout-minutes: 30
3434
run: |
3535
flutter pub get
36-
cd test_integration && flutter drive
36+
cd test_integration/ios
37+
pod install
38+
cd ..
39+
flutter drive
3740
3841
android:
3942
runs-on: ubuntu-latest

android/build.gradle

Lines changed: 14 additions & 15 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,29 +35,20 @@ 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
47-
48-
// Flag to enable Java 8 language APIs while supporting to older SDK Versions
49-
coreLibraryDesugaringEnabled true
46+
sourceCompatibility = JavaVersion.VERSION_17
47+
targetCompatibility = JavaVersion.VERSION_17
5048
}
5149

5250
defaultConfig {
5351
minSdkVersion 19
54-
55-
// Required when setting minSdkVersion to 20 or lower so we can use
56-
// the Java 8 language APIs as mentioned here:
57-
// https://developer.android.com/studio/write/java8-support#library-desugaring
58-
multiDexEnabled true
5952
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
6053
}
6154
lintOptions {
@@ -66,4 +59,10 @@ android {
6659
}
6760
}
6861

62+
gradle.projectsEvaluated {
63+
tasks.withType(JavaCompile) {
64+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
65+
}
66+
}
67+
6968
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

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)