Skip to content

minSdkVersion overwrite #173829

@robertnicjoo

Description

@robertnicjoo

Steps to reproduce

I just updated to Flutter (Channel stable, 3.35.1 and I am no longer able to build my app.

When ever i try to run or build my app minSdk overwrite to default and I receive errors because of it

Expected results

My app to be run and minSdk don't get overwrite

Actual results

Upgrading build.gradle.kts
Running Gradle task 'assembleDebug'...
e: file:///xxxxxx/android/app/build.gradle.kts:30:30: Expecting an element
e: file:///xxxxxx/android/app/build.gradle.kts:30:9: Function invocation 'minSdkVersion(...)' expected
e: file:///xxxxxx/android/app/build.gradle.kts:30:9: None of the following functions can be called with the arguments supplied: 
public abstract fun minSdkVersion(minSdkVersion: Int): Unit defined in com.android.build.api.dsl.ApplicationDefaultConfig
public abstract fun minSdkVersion(minSdkVersion: String?): Unit defined in com.android.build.api.dsl.ApplicationDefaultConfig
e: file:///xxxxxx/android/app/build.gradle.kts:30:9: Variable expected

FAILURE: Build failed with an exception.

I do minSdk = 21 and during the run it goes to minSdkVersion flutter.minSdkVersion hence the error above.

Code sample

Code sample
    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId = "xxxx.xxxxxx.xxxxxxx"
        // You can update the following values to match your application needs.
        // For more information, see: https://flutter.dev/to/review-gradle-config.
        minSdk = 21
        targetSdk = 36
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.35.1, on macOS 15.6 24G84 darwin-x64, locale
    en-ID) [3.1s]
    • Flutter version 3.35.1 on channel stable at /xxxxxxx/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 20f8274939 (11 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)
    [14.5s]
    • Android SDK at /xxxxxxx/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on
      this machine.
      To manually set the JDK path, use: `flutter config
      --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [6.9s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [32ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [30ms]
    • Android Studio at /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+-13391695-b895.109)

[✓] VS Code (version 1.103.1) [27ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.116.0

[✓] Connected device (3 available) [13.8s]
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15
      (API 35) (emulator)
    • macOS (desktop)              • macos         • darwin-x64     • macOS 15.6
      24G84 darwin-x64
    • Chrome (web)                 • chrome        • web-javascript • Google
      Chrome 139.0.7258.128

[✓] Network resources [1,012ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions