Skip to content

Commit 662dd7e

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 662dd7e

File tree

19 files changed

+115
-94
lines changed

19 files changed

+115
-94
lines changed

.github/workflows/flutter_integration.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
device: # Device names must be shown in `xcrun simctl list devices`
1313
- 'iPhone 15' # we are not specifying the iOS version as it tends to change
1414
fail-fast: false
15-
runs-on: macos-latest
15+
runs-on: macos-13
1616
steps:
1717
- uses: actions/checkout@v4
1818

@@ -70,4 +70,4 @@ jobs:
7070
disable-animations: true
7171
script: |
7272
flutter pub get
73-
cd test_integration && flutter drive
73+
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: 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/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)