Skip to content

Commit 9d10c6a

Browse files
authored
Fix Android build 20231010 (#232)
1 parent 195a617 commit 9d10c6a

File tree

7 files changed

+48
-31
lines changed

7 files changed

+48
-31
lines changed

.github/workflows/flutter.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ jobs:
6262
- name: Prepare packages/api
6363
run: ./packages/api/tool/build.sh
6464
- run: flutter pub get
65-
- run: flutter build apk --split-per-abi
65+
- name: Run flutter build apk
66+
run: |
67+
set -e
68+
69+
export JAVA_HOME=$JAVA_HOME_17_X64
70+
flutter doctor -v
71+
72+
flutter build apk --split-per-abi
6673
6774
- name: Setup GCP authentication
6875
uses: google-github-actions/auth@v1

.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
8-
channel: stable
7+
revision: "2524052335ec76bb03e04ede244b071f1b86d190"
8+
channel: "stable"
99

1010
project_type: app
1111

@@ -16,8 +16,8 @@ migration:
1616
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
1717
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
1818
- platform: android
19-
create_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
20-
base_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
19+
create_revision: 2524052335ec76bb03e04ede244b071f1b86d190
20+
base_revision: 2524052335ec76bb03e04ede244b071f1b86d190
2121
- platform: ios
2222
create_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
2323
base_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff

android/app/build.gradle

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "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,10 +12,7 @@ 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-
}
15+
def firebaseSDKVersion = project(':firebase_core').findProperty('FirebaseSDKVersion')
1316

1417
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1518
if (flutterVersionCode == null) {
@@ -21,15 +24,9 @@ if (flutterVersionName == null) {
2124
flutterVersionName = '1.0'
2225
}
2326

24-
def firebaseSDKVersion = project(':firebase_core').findProperty('FirebaseSDKVersion')
25-
26-
apply plugin: 'com.android.application'
27-
apply plugin: 'kotlin-android'
28-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
29-
3027
android {
31-
compileSdkVersion flutter.compileSdkVersion
3228
namespace "com.daohoangson.flutter_ttdemo"
29+
compileSdkVersion flutter.compileSdkVersion
3330
ndkVersion flutter.ndkVersion
3431

3532
compileOptions {

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.7.10'
2+
ext.kotlin_version = '1.9.10'
33
repositories {
44
google()
55
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.3.0'
9+
classpath 'com.android.tools.build:gradle:8.1.2'
1010
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
1111
classpath 'com.google.gms:google-services:4.3.8'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

android/gradle.properties

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
android.bundle.enableUncompressedNativeLibs=false
2-
android.enableJetifier=true
3-
android.useAndroidX=true
41
org.gradle.jvmargs=-Xmx1536M
2+
android.useAndroidX=true
3+
android.enableJetifier=true
4+
5+
# workaround for AGP 8, because some plugins are not updated yet
6+
# TODO: remove this for AGP 9
7+
# https://github.com/firebase/flutterfire/issues/11266#issuecomment-1670268368
8+
android.defaults.buildfeatures.buildconfig=true

android/gradle/wrapper/gradle-wrapper.properties

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

android/settings.gradle

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
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+
settings.ext.flutterSdkPath = flutterSdkPath()
210

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
11+
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
512

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
13+
plugins {
14+
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
15+
}
16+
}
817

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"
18+
include ":app"
19+
20+
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"

0 commit comments

Comments
 (0)