Skip to content

Commit 426b2f9

Browse files
committed
🚀 Migrate new Gradle scripts
1 parent e657ca4 commit 426b2f9

File tree

4 files changed

+49
-38
lines changed

4 files changed

+49
-38
lines changed

example/android/app/build.gradle

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "kotlin-kapt"
5+
id "dev.flutter.flutter-gradle-plugin"
6+
}
7+
18
def localProperties = new Properties()
29
def localPropertiesFile = rootProject.file('local.properties')
310
if (localPropertiesFile.exists()) {
@@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) {
613
}
714
}
815

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-
1416
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1517
if (flutterVersionCode == null) {
1618
flutterVersionCode = '1'
@@ -21,22 +23,15 @@ if (flutterVersionName == null) {
2123
flutterVersionName = '1.0'
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply plugin: 'kotlin-kapt'
27-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
28-
2926
android {
27+
namespace "com.fluttercandies.wechatAssetsPickerExample"
28+
3029
compileSdkVersion 34
3130

3231
sourceSets {
3332
main.java.srcDirs += 'src/main/kotlin'
3433
}
3534

36-
lintOptions {
37-
disable 'InvalidPackage'
38-
}
39-
4035
defaultConfig {
4136
applicationId "com.fluttercandies.wechatAssetsPickerExample"
4237
minSdkVersion 21
@@ -46,6 +41,16 @@ android {
4641
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
4742
}
4843

44+
kotlinOptions {
45+
jvmTarget = '17'
46+
}
47+
48+
compileOptions {
49+
// Sets Java compatibility to Java 17
50+
sourceCompatibility JavaVersion.VERSION_17
51+
targetCompatibility JavaVersion.VERSION_17
52+
}
53+
4954
signingConfigs {
5055
forAll {
5156
storeFile file("${rootDir.absolutePath}/key.jks")
@@ -73,6 +78,6 @@ flutter {
7378
}
7479

7580
dependencies {
76-
implementation 'com.github.bumptech.glide:glide:4.11.0'
77-
kapt 'com.github.bumptech.glide:compiler:4.11.0'
81+
implementation 'com.github.bumptech.glide:glide:4.15.0'
82+
kapt 'com.github.bumptech.glide:compiler:4.15.0'
7883
}

example/android/build.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = '1.7.21'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.3.1'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()

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.1-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip

example/android/settings.gradle

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1-
include ':app'
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
24

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
5+
pluginManagement {
6+
def flutterSdkPath = {
7+
def properties = new Properties()
8+
file("local.properties").withInputStream { properties.load(it) }
9+
def flutterSdkPath = properties.getProperty("flutter.sdk")
10+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11+
return flutterSdkPath
12+
}
13+
settings.ext.flutterSdkPath = flutterSdkPath()
514

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
15+
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
816

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
17+
repositories {
18+
google()
19+
mavenCentral()
20+
gradlePluginPortal()
21+
}
22+
}
23+
24+
plugins {
25+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
26+
id "com.android.application" version "8.2.2" apply false
27+
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
28+
}
29+
30+
include ":app"

0 commit comments

Comments
 (0)