Skip to content

Commit e91d296

Browse files
committed
Add workaround for APK builds
1 parent 357b7c1 commit e91d296

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

android/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,37 @@ rootProject.buildDir = '../build'
99
subprojects {
1010
project.buildDir = "${rootProject.buildDir}/${project.name}"
1111
}
12+
13+
// Workaround for APK builds - https://github.com/flutter/flutter/issues/153281
14+
subprojects {
15+
afterEvaluate { project ->
16+
if (project.extensions.findByName("android") != null) {
17+
Integer pluginCompileSdk = project.android.compileSdk
18+
if (pluginCompileSdk != null && pluginCompileSdk < 31) {
19+
project.logger.error(
20+
"Warning: Overriding compileSdk version in Flutter plugin: "
21+
+ project.name
22+
+ " from "
23+
+ pluginCompileSdk
24+
+ " to 31 (to work around https://issuetracker.google.com/issues/199180389)."
25+
+ "\nIf there is not a new version of " + project.name + ", consider filing an issue against "
26+
+ project.name
27+
+ " to increase their compileSdk to the latest (otherwise try updating to the latest version)."
28+
)
29+
project.android {
30+
compileSdk 31
31+
}
32+
}
33+
}
34+
}
35+
}
36+
1237
subprojects {
1338
project.evaluationDependsOn(':app')
1439
}
1540

41+
42+
1643
tasks.register("clean", Delete) {
1744
delete rootProject.buildDir
1845
}

0 commit comments

Comments
 (0)