rinf: Building apk requires rust stable toolchain stable-x86_64-pc-windows-msvc and doesn't work with nightly

It seems building for android fails if the stable windows toolchain is not installed.

Steps to reproduce

Setup everything but install rustup nightly only

> flutter build apk
C:\Users\raiyan.hossain\.cargo\bin\rustup.exe
error: toolchain 'stable-x86_64-pc-windows-msvc' is not installed

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\<UserName>\AppData\Local\Pub\Cache\hosted\pub.dev\rust_in_flutter-3.7.3\cargokit\gradle\plugin.gradle' line: 57

* What went wrong:
Execution failed for task ':rust_in_flutter:cargokitCargoBuildHubRelease'.
> Process 'command 'C:\Users\<UserName>\AppData\Local\Pub\Cache\hosted\pub.dev\rust_in_flutter-3.7.3\cargokit\gradle\..\run_rust_tool.cmd'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Running Gradle task 'assembleRelease'...                         2,822ms
Gradle task assembleRelease failed with exit code 1
NativeCommandExitException: Program "flutter.bat" ended with non-zero exit code: 1.

Switch to stable and try again

> rustup default stable
...
> flutter build apk
SUCCESSS

Switch to nightly and try again

> rustup default nightly
...
> flutter build apk
SUCCESS still works because the stable toolchain is still present even though it's not default?

Remove stable and try again

> rustup toolchain remove stable
...
> flutter build apk
FAILURE same as before

System Information

> rustc --version
rustc 1.74.0-nightly (8142a319e 2023-09-13)

> protoc --version
libprotoc 24.2

> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.13.4, on Microsoft Windows [Version 10.0.22621.2134], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.3)
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.82.2)
[√] Connected device (3 available)
[√] Network resources

• No issues found!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (13 by maintainers)

Most upvoted comments

Yes thank you. docs should be sufficient.

@temeddix I’ve verified the template works

Will get back to you on the original issue of nightly targets

Thanks for the report, we will inspect this as soon as possible.

P.S. Please include the system information as guided when leaving an issue 😃

Thanks

Sorry I didn’t include the system information. I was on mobile. I’ve updated the issue with steps to reproduce and system info.