Skip to content

Commit 500c319

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 500c319

File tree

19 files changed

+119
-98
lines changed

19 files changed

+119
-98
lines changed

.github/workflows/flutter_integration.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ on:
77

88
jobs:
99
ios:
10-
strategy:
11-
matrix:
12-
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
14-
fail-fast: false
1510
runs-on: macos-latest
1611
steps:
1712
- uses: actions/checkout@v4
@@ -22,7 +17,7 @@ jobs:
2217

2318
- uses: subosito/flutter-action@v2
2419
with:
25-
flutter-version: '3.24'
20+
flutter-version: '3.29'
2621
cache: true
2722

2823
# test_integration package depends on ably_flutter, so before we run integration
@@ -58,7 +53,7 @@ jobs:
5853
5954
- uses: subosito/flutter-action@v2
6055
with:
61-
flutter-version: '3.24'
56+
flutter-version: '3.29'
6257
cache: true
6358

6459
- name: 'Run Flutter Driver tests'
@@ -70,4 +65,4 @@ jobs:
7065
disable-animations: true
7166
script: |
7267
flutter pub get
73-
cd test_integration && flutter drive
68+
cd test_integration && flutter build apk && flutter drive

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
ruby 3.0.1
1+
ruby 3.4.5
22
flutter 3.29.0

android/build.gradle

Lines changed: 17 additions & 13 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

@@ -23,35 +25,31 @@ apply plugin: 'com.android.library'
2325

2426
dependencies {
2527
// https://github.com/ably/ably-java/
26-
implementation 'io.ably:ably-android:1.2.40'
28+
implementation 'io.ably:ably-android:1.4.1'
2729

2830
// https://firebase.google.com/docs/cloud-messaging/android/client
29-
implementation 'com.google.firebase:firebase-messaging:23.0.4'
31+
implementation 'com.google.firebase:firebase-messaging:23.0.6'
3032

3133
// https://github.com/google/desugar_jdk_libs
3234
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
3335
}
3436

3537
android {
36-
compileSdkVersion 34
38+
// older version of flutter sdk doesn't provide `compileSdkVersion` defaults to 34
39+
compileSdkVersion flutter.compileSdkVersion ?: 34
3740

3841
// Conditional for compatibility with AGP <4.2.
3942
if (project.android.hasProperty("namespace")) {
4043
namespace 'io.ably.flutter.plugin'
4144
}
4245

43-
// Require Java language level 8 so we can use Method References (used with Lambdas)
4446
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
47+
sourceCompatibility = JavaVersion.VERSION_17
48+
targetCompatibility = JavaVersion.VERSION_17
5049
}
5150

5251
defaultConfig {
5352
minSdkVersion 19
54-
5553
// Required when setting minSdkVersion to 20 or lower so we can use
5654
// the Java 8 language APIs as mentioned here:
5755
// https://developer.android.com/studio/write/java8-support#library-desugaring
@@ -66,4 +64,10 @@ android {
6664
}
6765
}
6866

67+
gradle.projectsEvaluated {
68+
tasks.withType(JavaCompile) {
69+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
70+
}
71+
}
72+
6973
apply from: file("./ably-agent.gradle")

example/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ android {
1414
compileOptions {
1515
coreLibraryDesugaringEnabled true
1616

17-
sourceCompatibility = JavaVersion.VERSION_1_8
18-
targetCompatibility = JavaVersion.VERSION_1_8
17+
sourceCompatibility = JavaVersion.VERSION_17
18+
targetCompatibility = JavaVersion.VERSION_17
1919
}
2020

2121
kotlinOptions {
22-
jvmTarget = JavaVersion.VERSION_1_8
22+
jvmTarget = JavaVersion.VERSION_17
2323
}
2424

2525
defaultConfig {

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

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>9.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -157,7 +157,7 @@
157157
97C146E61CF9000F007C117D /* Project object */ = {
158158
isa = PBXProject;
159159
attributes = {
160-
LastUpgradeCheck = 1300;
160+
LastUpgradeCheck = 1510;
161161
ORGANIZATIONNAME = "The Chromium Authors";
162162
TargetAttributes = {
163163
97C146ED1CF9000F007C117D = {
@@ -203,10 +203,12 @@
203203
/* Begin PBXShellScriptBuildPhase section */
204204
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
205205
isa = PBXShellScriptBuildPhase;
206+
alwaysOutOfDate = 1;
206207
buildActionMask = 2147483647;
207208
files = (
208209
);
209210
inputPaths = (
211+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
210212
);
211213
name = "Thin Binary";
212214
outputPaths = (
@@ -224,7 +226,6 @@
224226
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
225227
"${BUILT_PRODUCTS_DIR}/Ably/Ably.framework",
226228
"${BUILT_PRODUCTS_DIR}/AblyDeltaCodec/AblyDeltaCodec.framework",
227-
"${BUILT_PRODUCTS_DIR}/Toast/Toast.framework",
228229
"${BUILT_PRODUCTS_DIR}/ably_flutter/ably_flutter.framework",
229230
"${BUILT_PRODUCTS_DIR}/device_info_plus/device_info_plus.framework",
230231
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
@@ -235,7 +236,6 @@
235236
outputPaths = (
236237
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Ably.framework",
237238
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AblyDeltaCodec.framework",
238-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Toast.framework",
239239
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ably_flutter.framework",
240240
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info_plus.framework",
241241
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
@@ -249,6 +249,7 @@
249249
};
250250
9740EEB61CF901F6004384FC /* Run Script */ = {
251251
isa = PBXShellScriptBuildPhase;
252+
alwaysOutOfDate = 1;
252253
buildActionMask = 2147483647;
253254
files = (
254255
);
@@ -358,7 +359,7 @@
358359
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
359360
GCC_WARN_UNUSED_FUNCTION = YES;
360361
GCC_WARN_UNUSED_VARIABLE = YES;
361-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
362+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
362363
MTL_ENABLE_DEBUG_INFO = NO;
363364
SDKROOT = iphoneos;
364365
SUPPORTED_PLATFORMS = iphoneos;
@@ -449,7 +450,7 @@
449450
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
450451
GCC_WARN_UNUSED_FUNCTION = YES;
451452
GCC_WARN_UNUSED_VARIABLE = YES;
452-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
453+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
453454
MTL_ENABLE_DEBUG_INFO = YES;
454455
ONLY_ACTIVE_ARCH = YES;
455456
SDKROOT = iphoneos;
@@ -498,7 +499,7 @@
498499
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
499500
GCC_WARN_UNUSED_FUNCTION = YES;
500501
GCC_WARN_UNUSED_VARIABLE = YES;
501-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
502+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
502503
MTL_ENABLE_DEBUG_INFO = NO;
503504
SDKROOT = iphoneos;
504505
SUPPORTED_PLATFORMS = iphoneos;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -48,6 +48,7 @@
4848
ignoresPersistentStateOnLaunch = "NO"
4949
debugDocumentVersioning = "YES"
5050
debugServiceExtension = "internal"
51+
enableGPUValidationMode = "1"
5152
allowLocationSimulation = "YES">
5253
<BuildableProductRunnable
5354
runnableDebuggingMode = "0">

example/ios/Runner/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,9 @@
4949
</array>
5050
<key>UIViewControllerBasedStatusBarAppearance</key>
5151
<false/>
52+
<key>CADisableMinimumFrameDurationOnPhone</key>
53+
<true/>
54+
<key>UIApplicationSupportsIndirectInputEvents</key>
55+
<true/>
5256
</dict>
5357
</plist>

test_integration/android/app/build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ android {
1111
ndkVersion = flutter.ndkVersion
1212

1313
compileOptions {
14-
sourceCompatibility = JavaVersion.VERSION_1_8
15-
targetCompatibility = JavaVersion.VERSION_1_8
14+
coreLibraryDesugaringEnabled true
15+
16+
sourceCompatibility = JavaVersion.VERSION_17
17+
targetCompatibility = JavaVersion.VERSION_17
1618
}
1719

1820
kotlinOptions {
19-
jvmTarget = JavaVersion.VERSION_1_8
21+
jvmTarget = JavaVersion.VERSION_17
2022
}
2123

2224
defaultConfig {
@@ -42,3 +44,8 @@ android {
4244
flutter {
4345
source = "../.."
4446
}
47+
48+
dependencies {
49+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
50+
}
51+

0 commit comments

Comments
 (0)