Repository navigation
[3.35.1] Android build fails when minSdk is set below 24 in build.gradle.kts #173823
Copy link
Copy link
Closed
Closed
Copy link
Labels
a: buildBuilding flutter applications with the toolBuilding flutter applications with the toolc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35fyi-toolFor the attention of Flutter Tool teamFor the attention of Flutter Tool teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.workaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Description
Steps to reproduce
- Create a new Flutter project with Flutter 3.35
- Navigate to
android/app/build.gradle.kts - Set minSdk to 21
- Build the Android app
Expected results
Build success
Actual results
Build fails with syntax error due to minSdk = 21 is replaced with minSdkVersion flutter.minSdkVersion
Code sample
Code sample
[Paste your code here]Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.35.1, on macOS 15.6 24G84 darwin-arm64, locale en-VN) [278ms]
• Flutter version 3.35.1 on channel stable at /Users/khoa.nguyen/fvm/versions/3.35.1
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 20f8274939 (9 hours ago), 2025-08-14 10:53:09 -0700
• Engine revision 1e9a811bf8
• Dart version 3.9.0
• DevTools version 2.48.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
enable-lldb-debugging
[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1,160ms]
• Android SDK at /Users/khoa.nguyen/Library/Android/sdk
• Emulator version 35.5.10.0 (build_id 13402964) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment Homebrew (build 17.0.15+0)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [668ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16F6
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [8ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.3) [7ms]
• Android Studio at /Users/khoa.nguyen/Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
[✓] VS Code (version 1.103.0) [6ms]
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.116.0
[✓] Connected device (4 available) [5.9s]
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 16 (API 36) (emulator)
• iPhone 16 Pro Max (mobile) • 1FB5DCF2-7F04-4919-8C57-0E963C451C35 • ios • com.apple.CoreSimulator.SimRuntime.iOS-18-5 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.6 24G84 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 139.0.7258.67
[✓] Network resources [396ms]
• All expected network resources are available.
! Doctor found issues in 1 category.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: buildBuilding flutter applications with the toolBuilding flutter applications with the toolc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35fyi-toolFor the attention of Flutter Tool teamFor the attention of Flutter Tool teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.workaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Activity
[-]Android build fails when minSdk is set below 24 in build.gradle.kts[/-][+][3.35.1] Android build fails when minSdk is set below 24 in build.gradle.kts[/+]tirth-patel-nc commentedon Aug 15, 2025
alex-medinsh commentedon Aug 15, 2025
Hi @tirth-patel-nc!
I think there is a legitimate issue here. The report was about the migration script breaking your
build.gradle.ktsif it previously contained minSdk < 24, because it uses incorrect syntax when replacing the variable.It currently replaces
with
which is not valid kts syntax.
tirth-patel-nc commentedon Aug 15, 2025
sorry for the oversight! @alex-medinsh appreciate the correction. I did notice this replacement in earlier triage but must have overlooked it in this case.
Thanks for the report. Seeing the same behaviour with latest SDK versions. Doesn't happen on
3.32.8, hence marking it as a regression. Bisected it to #170882.Bisect Log
Build Logs
Screen.Recording.2025-08-15.at.3.51.37.PM.mov
9 remaining items
fix: Android build fails when minSdk is set below 24 in build.gradle.…
fix: Android build fails when minSdk is set below 24 in build.gradle.…
[CP-stable]fix: Android build fails when minSdk is set below 24 in bu…
fix: Android build fails when minSdk is set below 24 in build.gradle.…
fix: Android build fails when minSdk is set below 24 in build.gradle.…
github-actions commentedon Sep 3, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.fix: Android build fails when minSdk is set below 24 in build.gradle.…
fix: Android build fails when minSdk is set below 24 in build.gradle.…
fix: Android build fails when minSdk is set below 24 in build.gradle.…
fix: Android build fails when minSdk is set below 24 in build.gradle.…