Solving Flutter Build Issues with build.gradle
Recently, I encountered a frustrating issue with Flutter's latest version: my app wouldn't build after adding new code. I could only resolve it by modifying my android/build.gradle file.
The Fix:
Adding this block to build.gradle resolved the problem:
subprojects {
afterEvaluate { project ->
if (project.plugins.hasPlugin("com.android.application") ||
project.plugins.hasPlugin("com.android.library")) {
project.android {
compileSdkVersion 34
buildToolsVersion "34.0.0"
}
}
}
}
Why This Happens:
Tips:
Share this tip on LinkedIn to help others resolve similar build issues!
#project #Flutter #Gradle #MobileDevelopment #AppDevelopment