website
website copied to clipboard
Revise Download section of 'Start building Flutter Android apps on Windows' page
Page URL
https://docs.flutter.dev/get-started/install/windows/mobile/
Page source
https://github.com/flutter/website/tree/main/src/get-started/install/windows/mobile.md
Describe the problem
Hey guys. I have a small improvement suggestion for Flutter Installation Documentation > Download and install
The"Download then install Flutter" recommends downloading the Flutter SDK via an "installation bundle." to get the latest stable release of the Flutter SDK.
However, doing that leads to a problem when executing flutter doctor
on Windows:
$ flutter doctor --android-licenses
Error: The Flutter directory is not a clone of the GitHub project.
The flutter tool requires Git in order to operate properly;
to set up Flutter, run the following command:
git clone -b stable https://github.com/flutter/flutter.git
It feels like the user is doing something wrong, the documentation would be more helpful if guide users to use the git clone -b stable https://github.com/flutter/flutter.git
instead of "Download the installation bundle".
Additionally, git
is already included as a prerequisite on "Software Requirements" section. I suggest update the installation instructions to prioritize the git clone
method. This approach is easier and will reduce setup errors for new users.
Expected fix
Create a directory for Flutter SDK in your user's home directory:
New-Item -ItemType Directory -Path "$env:USERPROFILE\dev\flutter"
Clone the Flutter SDK into the newly created directory:
git clone -b stable https://github.com/flutter/flutter.git "$env:USERPROFILE\dev\flutter"
Add the Flutter bin directory to the environment path: [...]
Additional context
No response
I would like to fix this problem.
- [ ] I will try and fix this problem on docs.flutter.dev.
Hi @the-eduardo
I also prefer git clone
method.
For the error The Flutter directory is not a clone of the GitHub project
, it seems git is not inside your system path. Can you share the output of git --version
?
Hi @huycozy. I'm using Scoop to keep git updated:
$ git version
git version 2.43.0.windows.1
$ which git
C:\Users\eduar\scoop\shims\git.exe
Scoop automatically sets a new env (user variable) key GIT_INSTALL_ROOT: C:\Users\eduar\scoop\apps\git\current
after installation.
I don't know if it could be the cause of this problem
I'm also sharing the flutter path, as it may be something helpful:
$ cd .\eduar\AppData\Local\flutter\
$ pwd
Path
----
C:\Users\eduar\AppData\Local\flutter
$ git clone -b stable https://github.com/flutter/flutter.git .
Cloning into '.'...
remote: Enumerating objects: 497152, done.
remote: Counting objects: 100% (239/239), done.
remote: Compressing objects: 100% (177/177), done.
remote: Total 497152 (delta 100), reused 131 (delta 53), pack-reused 496913
Receiving objects: 100% (497152/497152), 120.47 MiB | 6.56 MiB/s, done.
Resolving deltas: 100% (389046/389046), done.
Updating files: 100% (7979/7979), done.
$ flutter doctor --android-licenses
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine ...
Expanding downloaded archive with 7z...
Building flutter tool...
Running pub upgrade...
Resolving dependencies... (2.9s)
Got dependencies.
Downloading Material fonts... 1,930ms
Downloading Gradle Wrapper... 173ms
Downloading package sky_engine... 233ms
Downloading flutter_patched_sdk tools... 436ms
Downloading flutter_patched_sdk_product tools... 302ms
Downloading windows-x64 tools... 2,935ms
Downloading windows-x64/font-subset tools... 325ms
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to
resolve this.
So, you are facing two separate issues with Flutter SDK from two sources: installation bundle and git clone, right? If so, this is quite strange, they should output the same result (I assume you added Flutter to Windows PATH variable correctly).
For the 1st issue (The Flutter directory is not a clone of the GitHub project
), could you share the output of flutter doctor -v
?
For the 2nd issue (Android sdkmanager not found
), please check this to see if it helps.
Hello there, as I told before the "The Flutter directory is not a clone of the GitHub project" was fixed since I replaced the (downloaded Flutter Bundle) with the git clone
version, since then I couldn't replicate the issue, I'm not sure what happened. It can't be a wrong PATH because in the first time it was correctly locating the flutter, although is was returning the first issue.
$ which flutter
C:\Users\eduar\AppData\Local\flutter\bin\flutter.bat
After the git clone -b stable https://github.com/flutter/flutter.git .
it started working as expected, I've used this command in the same terminal (a PowerShell running with admin privileges), naturally it was using the same PATH as the previous command that returned the not a clone of the GitHub project
error.
$ flutter doctor -v
[√] Flutter (Channel stable, 3.19.0, on Microsoft Windows [Version 10.0.22621.3155], locale en-US)
• Flutter version 3.19.0 on channel stable at C:\Users\eduar\AppData\Local\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision bae5e49bc2 (10 days ago), 2024-02-13 17:46:18 -0800
• Engine revision 04817c99c9
• Dart version 3.3.0
• DevTools version 2.31.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\eduar\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
• All Android licenses accepted.
[√] Chrome - develop for the web
• CHROME_EXECUTABLE = C:\Users\eduar\AppData\Local\Vivaldi\Application\vivaldi.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.8.34525.116
• Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2023.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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 17.0.7+0-b2043.56-10550314)
[√] IntelliJ IDEA Ultimate Edition (version 2023.3)
• IntelliJ at C:\Users\eduar\AppData\Local\Programs\IntelliJ IDEA Ultimate
• Flutter plugin version 78.1.1
• Dart plugin version 233.13763.5
[√] VS Code (version 1.80.1)
• VS Code at C:\Users\eduar\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.3155]
• Chrome (web) • chrome • web-javascript • unknown
• Edge (web) • edge • web-javascript • Microsoft Edge 121.0.2277.112
[√] Network resources
• All expected network resources are available.
• No issues found!
As I mentioned, I couldn't replicate the issue anymore, it may be an isolated weird case, still I would recommend add the git clone
command as an alternative to installing the Flutter.
For Android sdkmanager not found
I just hadn't finished installing it at that time.
@the-eduardo : This particular issue only occurs when someone downloads the bundle as a ZIP from the GitHub repo directly. The documentation instructs users to either download via VS Code's Flutter plugin or clicking the button on the docs page. Following either of those paths as laid out in the docs works as explained. As this issue falls outside the paths given in the documentation, we will close this issue for now.