To build Android apps with Flutter, you will need to install the Android SDK. But if you install the Android SDK to a custom location, as you might to organize your tools, Flutter will not be able to find it and thus not work. The following resolves this issue:
The short version:
> cd c:\dev\git\flutter
> flutter doctor
> flutter config --android-sdk c:\dev\android\sdk
> flutter doctor --android-licenses
> flutter doctor
The long version:
Assuming you have followed the Flutter installation instructions
Source: https://flutter.dev/docs/get-started/install/windows
Source: https://flutter.dev/docs/get-started/install/windows
You should have the Flutter SDK extracted or git cloned in a directory, such as
And updated the environment Path to include
And installed Android Studio, which will install the Android SDK.
Note: While IntelliJ IDEA Ultimate Edition can also be used for Flutter and Android development, Android Studio is gracefully made by IntelliJ so the interfaces are similar, with Android Studio obviously being more targeted toward Android development. Also most tutorials, internet how/what searches will reference Android Studio.
> c:\dev\git\flutter
And updated the environment Path to include
c:\dev\git\flutter
And installed Android Studio, which will install the Android SDK.
The default install location is usuallyto be flustered to not find the Android SDK
c:\Users\[user]\AppData\Local\Android\sdk
But you may want a shorter and more accessible location such as
c:\dev\android\sdk
Which is what causes Flutter
After all those downloads and installs,
You should run flutter doctor, which validates your installation
Well, the first error is Flutter cannot find the Android SDK.
If you installed the Android SDK into a custom location, such as
You will need to tell Flutter about its location,
which is not in the installation instructions.
You should run flutter doctor, which validates your installation
> cd c:\dev\git\flutter
> flutter doctor
Well, the first error is Flutter cannot find the Android SDK.
If you installed the Android SDK into a custom location, such as
c:\dev\android\sdk
You will need to tell Flutter about its location,
which is not in the installation instructions.
But some internet searching yielded flutter has an option to update its config
> flutter config --android-sdk c:\dev\android\sdk
Source: https://github.com/flutter/flutter/issues/15114#issuecomment-431793370
Running flutter doctor again yields
I guess if you run a Flutter project or run the emulator you may get the license prompts then, but might as well accept them now.
Running flutter doctor again yields
So all good.
Flutter knows where the Android SDK is installed.
> flutter doctor
I guess if you run a Flutter project or run the emulator you may get the license prompts then, but might as well accept them now.
> flutter doctor --android-licenses
Make sure you thoroughly read them, and dispute them if you do not agree, yup.Running flutter doctor again yields
> flutter doctor
So all good.
Flutter knows where the Android SDK is installed.
Note: While IntelliJ IDEA Ultimate Edition can also be used for Flutter and Android development, Android Studio is gracefully made by IntelliJ so the interfaces are similar, with Android Studio obviously being more targeted toward Android development. Also most tutorials, internet how/what searches will reference Android Studio.
-End of Document-
Thanks for reading
No comments:
Post a Comment