Skip to content

build apk ignores --target-platform if --debug is set #153359

@thgoebel

Description

@thgoebel

Steps to reproduce

  1. flutter create testproject
  2. cd testproject
  3. flutter build apk --target-platform=android-arm64 --debug

Expected results

The resulting app-debug.apk only contains code for android-arm64.

Actual results

The resulting app-debug.apk contains code for android-arm, android-arm64, android-x86, android-x64.

When running without --debug, i.e. flutter build apk --target-platform=android-arm64 then the resulting app-release.apk correctly contains only code for android-arm64.

Why this is relevant

I am using https://github.com/cunarist/rinf. Sometimes you have to do a flutter clean. And (re)compiling Rust code for 4 target archs takes a loooong time. But I only need and only want to compile for one arch. I expect --target-platform to work with --debug.

Alternatively (but not ideal), the output of flutter build apk --help should indicate that these two options are incompatible.

Code sample

No need for a code sample. Just run flutter create testproject and use that.

Screenshots or Video

n/a

Logs

n/a

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.0, on macOS 14.5 23F79 darwin-arm64, locale en-CH)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.92.0)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toolc: new featureNothing broken; request for a new capabilityfound in release: 3.24Found to occur in 3.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions