Skip to content

Commit 9b3e2be

Browse files
author
skylastn
committed
Upgrade Compability with flutter 3.29.0
1 parent 43eca6c commit 9b3e2be

10 files changed

Lines changed: 249 additions & 173 deletions

File tree

example/android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ GeneratedPluginRegistrant.java
1111
key.properties
1212
**/*.keystore
1313
**/*.jks
14+
app/.cxx

example/android/app/build.gradle

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,28 @@
1-
def localProperties = new Properties()
2-
def localPropertiesFile = rootProject.file('local.properties')
3-
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withReader('UTF-8') { reader ->
5-
localProperties.load(reader)
6-
}
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id 'dev.flutter.flutter-gradle-plugin'
76
}
87

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-
14-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15-
if (flutterVersionCode == null) {
16-
flutterVersionCode = '1'
17-
}
188

19-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20-
if (flutterVersionName == null) {
21-
flutterVersionName = '1.0'
9+
def localProperties = new Properties()
10+
def localPropertiesFile = rootProject.file('local.properties')
11+
if (localPropertiesFile.exists()) {
12+
localProperties.load(new FileInputStream(localPropertiesFile))
2213
}
2314

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2815
android {
2916
compileSdkVersion flutter.compileSdkVersion
17+
namespace = 'com.ionicfirebaseapp.getwidget_example'
3018

3119
compileOptions {
32-
sourceCompatibility JavaVersion.VERSION_1_8
33-
targetCompatibility JavaVersion.VERSION_1_8
20+
sourceCompatibility JavaVersion.VERSION_21
21+
targetCompatibility JavaVersion.VERSION_21
3422
}
3523

3624
kotlinOptions {
37-
jvmTarget = '1.8'
25+
jvmTarget = '21'
3826
}
3927

4028
sourceSets {
@@ -48,8 +36,8 @@ android {
4836
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
4937
minSdkVersion 21
5038
targetSdkVersion flutter.targetSdkVersion
51-
versionCode flutterVersionCode.toInteger()
52-
versionName flutterVersionName
39+
versionCode = flutter.versionCode
40+
versionName = flutter.versionName
5341
}
5442

5543
buildTypes {
@@ -64,7 +52,3 @@ android {
6452
flutter {
6553
source '../..'
6654
}
67-
68-
dependencies {
69-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
70-
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.ionicfirebaseapp.getwidget_example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<application
43
android:label="GetWidget"
54
android:name="${applicationName}"

example/android/build.gradle

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = '1.6.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.2'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
@@ -21,11 +8,21 @@ allprojects {
218
rootProject.buildDir = '../build'
229
subprojects {
2310
project.buildDir = "${rootProject.buildDir}/${project.name}"
11+
afterEvaluate { project ->
12+
if (project.hasProperty('android')) {
13+
project.android {
14+
if (namespace == null) {
15+
namespace project.group
16+
}
17+
}
18+
}
19+
}
2420
}
21+
2522
subprojects {
2623
project.evaluationDependsOn(':app')
2724
}
2825

29-
task clean(type: Delete) {
26+
tasks.register('clean', Delete) {
3027
delete rootProject.buildDir
3128
}

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

example/android/settings.gradle

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
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+
}()
9+
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
211

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
518

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
19+
plugins {
20+
id 'dev.flutter.flutter-plugin-loader' version '1.0.0'
21+
id 'com.android.application' version '8.3.2' apply false
22+
id 'org.jetbrains.kotlin.android' version '1.9.20' apply false
23+
id 'com.google.gms.google-services' version '4.3.15' apply false
24+
}
825

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"
26+
include ':app'

0 commit comments

Comments
 (0)