Skip to content

Commit ef85d48

Browse files
committed
build: Add android build workaround for new flutter version
1 parent ae0999e commit ef85d48

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

android/build.gradle

+25-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,34 @@ allprojects {
66
}
77

88
rootProject.buildDir = '../build'
9+
10+
// Workaround for building with Flutter 3.24
11+
// See: https://github.com/flutter/flutter/issues/153281#issuecomment-2292201697
912
subprojects {
10-
project.buildDir = "${rootProject.buildDir}/${project.name}"
13+
afterEvaluate { project ->
14+
if (project.extensions.findByName("android") != null) {
15+
Integer pluginCompileSdk = project.android.compileSdk
16+
if (pluginCompileSdk != null && pluginCompileSdk < 31) {
17+
project.logger.error(
18+
"Warning: Overriding compileSdk version in Flutter plugin: "
19+
+ project.name
20+
+ " from "
21+
+ pluginCompileSdk
22+
+ " to 31 (to work around https://issuetracker.google.com/issues/199180389)."
23+
+ "\nIf there is not a new version of " + project.name + ", consider filing an issue against "
24+
+ project.name
25+
+ " to increase their compileSdk to the latest (otherwise try updating to the latest version)."
26+
)
27+
project.android {
28+
compileSdk 31
29+
}
30+
}
31+
}
32+
}
1133
}
1234
subprojects {
13-
project.evaluationDependsOn(':app')
35+
project.buildDir = "${rootProject.buildDir}/${project.name}"
36+
project.evaluationDependsOn(":app")
1437
}
1538

1639
tasks.register("clean", Delete) {

0 commit comments

Comments
 (0)