Getting Started with flutter
👉Download flutter SDK zip from flutter official website Click Here to Download
👉Extract the zip file and place the contained
flutter
in the desired installation location for the Flutter SDK (for example, C:\Users\<your-user-name>\
flutter_folder).👉Open the Environment variable setting of your pc and click on PATH variable (If you cant see the path variable create one ) then put the Flutter SDK bin path to the path. for example in my case it is C:\Users\<your-user-name>\flutter_folder\flutter\bin
👉then open your windows command prompt and run following command to check wheather the dart path and flutter sdk path is same or not . If it is same you are going good , if not you got a problem (cheers solving it by yourself )
C:\>where flutter dart
in my case this should be the output
C:\Users\<your-user-name>\flutter_folder\flutter\bin\flutter
C:\Users\<your-user-name>\flutter_folder\flutter\bin\flutter.bat
C:\Users\<your-user-name>\flutter_folder\flutter\bin\dart
C:\Users\<your-user-name>\flutter_folder\flutter\bin\dart.bat
👉Then run the following command from the flutter containing folder to check the status of flutter installation (in my case the command will be )
C:\Users\<your-user-name>\flutter_folder>flutter doctor
(I am supposing that you have got no error during running this command, If you got one, bellow I have mentioned some errors which i encountered during this command, match the error,if you too have got the same error as mine, you can solve it by my explained solution)
Let's setup android studio if you have not installed Android studio yet
👉 Install Android Studio Click Here To Download Android Studio
Now open Android Studio and navigate to SDK Manager>SDK Platform >Show Package Details>Android SDK Build-Tools>29.0.2>Apply to download and install the Android SDK and related build tools.
Configure the ANDROID_HOME environment variable
👉 Add Local Variable
ANDROID_HOME - C:\Users\<your-user-name>\AppData\Local\Android\Sdk
👉 Add this path to Local Path
C:\Users\<your-user-name>\AppData\Local\Android\Sdk\tools
C:\Users\<your-user-name>\AppData\Local\Android\Sdk\platform-tools
Errors while I got during my flutter installation and how I solved them
👉Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
Then run following command C:\Users\LENOVO\flutter_folder>flutter doctor --android-licenses
and accept all the licences by entering Y to every licence
Then run flutter doctor agin to check if every issue is resolved or not C:\Users\<your-user-name>\flutter_folder>flutter doctor
If you get no issues found output from flutter doctor then congratulations again we are going right .
Set up your Android device
(or you can start emulator from your android studio-how to start emulator is explained in another blog )
To prepare to run and test your Flutter app on an Android device, you need an Android device running Android 4.1 (API level 16) or higher.
- Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
- Windows-only: Install the Google USB Driver.
- Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
- In the terminal, run the
flutter devices
command to verify that Flutter recognizes your connected Android device. By default, Flutter uses the version of the Android SDK where youradb
tool is based. If you want Flutter to use a different installation of the Android SDK, you must set theANDROID_SDK_ROOT
environment variable to that installation directory.
Note if you get error like
👉'adb' is not recognized as an internal or external command, operable program or batch file
solution: Add the following path to your environment variable PATH (you need to have android studio installed)
C:\Users\<your-user-name>\AppData\Local\Android\Sdk\platform-tools
We are almost done ! now lets configure our favourite code editor for better coding experiance in flutter (My fav is visual studio code , so I am going to configure that one)
Configuration of code editor (VS Code)
- Open Vs Code and Go to View > Command Palette
- Type “install”, and select Extensions: Install Extensions.
- Type “flutter” in the extensions search field, select Flutter in the list, and click Install. This also installs the required Dart plugin. Now lets check up every thing is good to go in vs code or not with the help of flutter doctor
- Go to View > Command Palette
- Type “doctor”, and select the Flutter: Run Flutter Doctor.if this gives output no issues found congratulations again just one last step
Create a testing application through vs code command pallet (VS Code)
- Open View > Command Palette.
- Type “flutter”, and select the Flutter: New Application Project.
- Create or select the parent directory for the new project folder.
- Enter a project name, such as demo, and press Enter.
- Wait for project creation to complete and the
main.dart
file to appear.
<=====================================================================>
Other flutter errors occur during installation if the environment variable not set properly(In my case this errors didn't occur)
👉'where' is not recognized as an internal or external command operable program or batch file
Solution : C:\Windows\System32;C:\Program Files\git
👉cmd crashes when using any flutter command
Solution : Add path C:\Windows\System32\WindowsPowerShell\v1.0 to your PATH environment variable
0 Comments