Skip to content

Commit e69a0e1

Browse files
committed
feat(example): upgrade to Android 14 and AGP 8
1 parent 30d7385 commit e69a0e1

File tree

6 files changed

+32
-14
lines changed

6 files changed

+32
-14
lines changed

push/example/android/app/build.gradle

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ if (flutterVersionName == null) {
2424
}
2525

2626
android {
27-
compileSdkVersion 33
27+
compileSdkVersion 34
2828

2929
compileOptions {
30-
sourceCompatibility JavaVersion.VERSION_1_8
31-
targetCompatibility JavaVersion.VERSION_1_8
30+
sourceCompatibility JavaVersion.VERSION_17
31+
targetCompatibility JavaVersion.VERSION_17
32+
coreLibraryDesugaringEnabled true
3233
}
3334

3435
kotlinOptions {
35-
jvmTarget = '1.8'
36+
jvmTarget = '17'
3637
}
3738

3839
sourceSets {
@@ -42,10 +43,13 @@ android {
4243
defaultConfig {
4344
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4445
applicationId "uk.orth.push.example"
46+
// Convert API level to Android version with https://apilevels.com/
4547
minSdkVersion Math.max(19, flutter.minSdkVersion)
46-
targetSdkVersion Math.max(33, flutter.targetSdkVersion)
48+
targetSdkVersion Math.max(34, flutter.targetSdkVersion)
4749
versionCode flutterVersionCode.toInteger()
4850
versionName flutterVersionName
51+
// https://pub.dev/packages/flutter_local_notifications#-android-setup
52+
multiDexEnabled true
4953
}
5054

5155
buildTypes {
@@ -62,4 +66,8 @@ flutter {
6266
source '../..'
6367
}
6468

65-
dependencies {}
69+
dependencies {
70+
// https://pub.dev/packages/flutter_local_notifications#-android-setup
71+
// Latest version on https://mvnrepository.com/artifact/com.android.tools/desugar_jdk_libs
72+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
73+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
org.gradle.jvmargs=-Xmx1536M
22
android.useAndroidX=true
33
android.enableJetifier=true
4+
# Workaround for gradle build error: `Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).`
5+
# https://stackoverflow.com/a/77861041/7365866
6+
kotlin.jvm.target.validation.mode = IGNORE

push/example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip

push/example/android/settings.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ pluginManagement {
1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
2121
// Versions available on https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google
22-
id "com.android.application" version "7.4.2" apply false
23-
id "org.jetbrains.kotlin.android" version "1.8.21" apply false
22+
id "com.android.application" version "8.3.2" apply false
23+
id "org.jetbrains.kotlin.android" version "2.0.0-RC1" apply false
2424
// This was manually added. Versions available on https://mvnrepository.com/artifact/com.google.gms/google-services?repo=google
2525
id "com.google.gms.google-services" version "4.4.1" apply false
26+
// This was added to use "JVM Toolchain". See https://kotlinlang.org/docs/gradle-configure-project.html
27+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
2628
}
2729

2830
include ":app"

push/example/lib/main.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:flutter/cupertino.dart';
12
import 'package:flutter/material.dart';
23
import 'package:flutter_hooks/flutter_hooks.dart';
34
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
@@ -162,8 +163,10 @@ class MyApp extends HookWidget {
162163
Text('Messages',
163164
style: Theme.of(context).textTheme.headlineMedium),
164165
Row(children: [
165-
Text('Recent foreground notification',
166-
style: Theme.of(context).textTheme.headlineSmall),
166+
Flexible(
167+
child: Text('Recent foreground notification',
168+
style: Theme.of(context).textTheme.headlineSmall),
169+
),
167170
IconButton(
168171
onPressed: () {
169172
messagesReceived.value = [];
@@ -173,8 +176,10 @@ class MyApp extends HookWidget {
173176
RemoteMessagesWidget(messagesReceived.value),
174177
Row(
175178
children: [
176-
Text('Recent background notification',
177-
style: Theme.of(context).textTheme.headlineSmall),
179+
Flexible(
180+
child: Text('Recent background notification',
181+
style: Theme.of(context).textTheme.headlineSmall),
182+
),
178183
IconButton(
179184
onPressed: () {
180185
backgroundMessagesReceived.value = [];

push/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
sdk: flutter
2020
flutter_hooks: ^0.18.6
2121
share_plus: ^7.0.0
22-
flutter_local_notifications: ^14.0.0+1
22+
flutter_local_notifications: ^17.1.0
2323

2424
# When depending on this package from a real application you should use:
2525
# push: ^x.y.z

0 commit comments

Comments
 (0)