Skip to content

Commit fe07ede

Browse files
authored
Bump Gradle dependencies (#952)
* bump Gradle dependencies * example: upgrade to declarative Gradle buildfiles * bump to Gradle 8.7 * more bumps * example: remove dependency on android_path_provider * downgrade androidx.annotation:annotation to 1.6.0 * example app: make to build to Gradle/AGP 8, set java bytecode to 8 * bump min Flutter to 3.19 * bump Dart deps * add build example app step
1 parent c82260b commit fe07ede

File tree

10 files changed

+91
-80
lines changed

10 files changed

+91
-80
lines changed

.github/workflows/prepare.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
flutter-version: ["3.10.x", "3.13.x", "3.16.x", "3.19.x"]
16+
flutter-version: ["3.19.x"]
1717

1818
steps:
1919
- name: Clone repository
@@ -25,9 +25,19 @@ jobs:
2525
channel: stable
2626
flutter-version: ${{ matrix.flutter-version }}
2727

28+
- name: Set up Java
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: temurin
32+
java-version: 21
33+
2834
- name: flutter pub get
2935
run: flutter pub get
3036

37+
- name: Build example app
38+
working-directory: example
39+
run: flutter build apk --debug
40+
3141
- name: dart format
3242
run: dart format --set-exit-if-changed .
3343

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.11.8
2+
3+
- Dependencies update (#952)
4+
- Gradle buildscripts on Android
5+
- Bump minimum Android SDK to 21
6+
- Bump minimum Flutter to 3.19
7+
18
## 1.11.7
29

310
- Update dependencies (#946)

android/build.gradle

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
group = "vn.hunghd.flutterdownloader"
2+
version = "1.0-SNAPSHOT"
3+
14
buildscript {
2-
ext.kotlin_version = "1.9.0"
35
repositories {
46
google()
57
mavenCentral()
@@ -8,50 +10,47 @@ buildscript {
810

911
dependencies {
1012
classpath "com.android.tools.build:gradle:7.4.2"
11-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"
1214
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.0"
1315
}
1416
}
1517

18+
repositories {
19+
google()
20+
mavenCentral()
21+
}
22+
1623
apply plugin: "com.android.library"
1724
apply plugin: "kotlin-android"
1825
apply plugin: "org.jlleitschuh.gradle.ktlint"
1926

20-
group "vn.hunghd.flutterdownloader"
21-
version "1.0-SNAPSHOT"
22-
23-
rootProject.allprojects {
24-
repositories {
25-
google()
26-
mavenCentral()
27-
}
28-
}
29-
3027
android {
31-
namespace "vn.hunghd.flutterdownloader"
32-
compileSdk 34
28+
namespace = "vn.hunghd.flutterdownloader"
29+
compileSdk = 34
3330

3431
compileOptions {
3532
sourceCompatibility JavaVersion.VERSION_1_8
3633
targetCompatibility JavaVersion.VERSION_1_8
3734
}
3835

3936
kotlinOptions {
40-
jvmTarget = "1.8"
37+
jvmTarget = JavaVersion.VERSION_1_8
38+
// allWarningsAsErrors = true // TODO(bartekpacia): Re-enable
4139
}
4240

4341
sourceSets {
4442
main.java.srcDirs += "src/main/kotlin"
43+
test.java.srcDirs += "src/test/kotlin"
4544
}
4645

4746
defaultConfig {
48-
minSdk 19
49-
targetSdk 33
47+
minSdk = 21
48+
targetSdk = 34
5049
}
5150
}
5251

5352
dependencies {
54-
implementation "androidx.work:work-runtime:2.7.1"
55-
implementation "androidx.annotation:annotation:1.5.0"
56-
implementation "androidx.core:core-ktx:1.9.0"
53+
compileOnly "androidx.annotation:annotation:1.6.0"
54+
implementation "androidx.core:core-ktx:1.13.1"
55+
implementation "androidx.work:work-runtime:2.9.0"
5756
}

example/android/app/build.gradle

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "org.jetbrains.kotlin.android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file("local.properties")
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty("flutter.sdk")
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = "1"
@@ -21,21 +22,26 @@ if (flutterVersionName == null) {
2122
flutterVersionName = "1.0"
2223
}
2324

24-
apply plugin: "com.android.application"
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2825
android {
29-
compileSdk 34
30-
31-
namespace "vn.hunghd.example"
26+
namespace = "vn.hunghd.example"
27+
compileSdk = 34
28+
ndkVersion = flutter.ndkVersion
3229

3330
defaultConfig {
3431
applicationId "vn.hunghd.example"
35-
minSdk 19
36-
targetSdk 33
37-
versionCode flutterVersionCode.toInteger()
38-
versionName flutterVersionName
32+
minSdk = 21
33+
targetSdk = 34
34+
versionCode = flutterVersionCode.toInteger()
35+
versionName = flutterVersionName
36+
}
37+
38+
compileOptions {
39+
sourceCompatibility = JavaVersion.VERSION_1_8
40+
targetCompatibility = JavaVersion.VERSION_1_8
41+
}
42+
43+
kotlinOptions {
44+
jvmTarget = JavaVersion.VERSION_1_8
3945
}
4046

4147
buildTypes {

example/android/app/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools" package="vn.hunghd.flutter_downloader_example">
2+
xmlns:tools="http://schemas.android.com/tools">
33

44
<uses-permission android:name="android.permission.INTERNET"/>
55
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/>

example/android/build.gradle

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = "1.7.22"
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath "com.android.tools.build:gradle:7.4.2"
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
14-
allprojects {
15-
repositories {
16-
google()
17-
mavenCentral()
18-
}
19-
}
20-
211
rootProject.buildDir = "../build"
222
subprojects {
233
project.buildDir = "${rootProject.buildDir}/${project.name}"
@@ -27,5 +7,5 @@ subprojects {
277
}
288

299
tasks.register("clean", Delete) {
30-
delete rootProject.buildDir
10+
delete(rootProject.buildDir)
3111
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip

example/android/settings.gradle

+20-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
include ":app"
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
411

5-
def plugins = new Properties()
6-
def pluginsFile = new File(flutterProjectRoot.toFile(), ".flutter-plugins")
7-
if (pluginsFile.exists()) {
8-
pluginsFile.withReader("UTF-8") { reader -> plugins.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
917
}
1018

11-
plugins.each { name, path ->
12-
def pluginDirectory = flutterProjectRoot.resolve(path).resolve("android").toFile()
13-
include ":$name"
14-
project(":$name").projectDir = pluginDirectory
19+
plugins {
20+
id("dev.flutter.flutter-plugin-loader")
21+
id("com.android.application") version ("8.3.1") apply false
22+
id("org.jetbrains.kotlin.android") version ("1.9.23") apply false
1523
}
24+
25+
include(":app")

example/pubspec.yaml

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@ version: 1.0.0+1
44
publish_to: none
55

66
environment:
7-
sdk: ">=3.0.0 <4.0.0"
8-
flutter: ">=3.10.0"
7+
sdk: ">=3.3.0 <4.0.0"
8+
flutter: ">=3.19.0"
99

1010
dependencies:
11-
android_path_provider: ^0.3.0
12-
device_info_plus: ^8.0.0
11+
device_info_plus: ^10.1.0
1312
flutter:
1413
sdk: flutter
1514
flutter_downloader:
1615
path: ../
17-
path_provider: ^2.1.2
18-
permission_handler: ^10.0.0
16+
path_provider: ^2.1.3
17+
permission_handler: ^11.3.1
1918

2019
dev_dependencies:
2120
flutter_test:
2221
sdk: flutter
23-
leancode_lint: ^4.0.0+2
22+
leancode_lint: ^12.1.0
2423

2524
flutter:
2625
uses-material-design: true

pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ flutter:
1515
pluginClass: FlutterDownloaderPlugin
1616

1717
environment:
18-
sdk: ">=3.0.0 <4.0.0"
19-
flutter: ">=3.10.0"
18+
sdk: ">=3.3.0 <4.0.0"
19+
flutter: ">=3.19.0"
2020

2121
dependencies:
2222
flutter:
@@ -25,4 +25,4 @@ dependencies:
2525
dev_dependencies:
2626
flutter_test:
2727
sdk: flutter
28-
leancode_lint: ^4.0.0+2
28+
leancode_lint: ^12.1.0

0 commit comments

Comments
 (0)