Skip to content

Commit

Permalink
android: Increase compileSdkVersion to 31 for all plugins
Browse files Browse the repository at this point in the history
This commit updates the `compileSdkVersion` for all plugins to resolve the
`android:attr/lStar not found` error encountered during build. It adjusts the
compile SDK version to 31 to align with AndroidX dependencies and newer Android
SDK requirements. This change is made in the `subprojects` section of the
`android/build.gradle` file to ensure all plugins adhere to this version
without manual updates.

flutter/flutter#153281 (comment)
  • Loading branch information
calcitem committed Aug 17, 2024
1 parent 4faf6b7 commit 78b42a9
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/ui/flutter_app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,29 @@ allprojects {

rootProject.buildDir = '../build'
subprojects {
afterEvaluate { project ->
if (project.extensions.findByName("android") != null) {
Integer pluginCompileSdk = project.android.compileSdk
if (pluginCompileSdk != null && pluginCompileSdk < 31) {
project.logger.error(
"Warning: Overriding compileSdk version in Flutter plugin: "
+ project.name
+ " from "
+ pluginCompileSdk
+ " to 31 (to work around https://issuetracker.google.com/issues/199180389)."
+ "\nIf there is not a new version of " + project.name + ", consider filing an issue against "
+ project.name
+ " to increase their compileSdk to the latest (otherwise try updating to the latest version)."
)
project.android {
compileSdk 31
}
}
}
}

project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
Expand Down

0 comments on commit 78b42a9

Please sign in to comment.