After learning Dart, we are going to our destination i.e. Flutter and we will learn how to install SDK in Android Studio for Flutter.
Table of Contents
How to install Dark SDK in Android Studio
We have already learned to install Dart in Android Studio. If you have missed that class you can check it out here:
Introduction to Dart Programming & its installation (Class 7)
7 easy steps to install Flutter SDK
Now we will learn to install Flutter SDK in the following 7 easy steps:-
Step 1 – Which Android SDK tools should I install for Flutter
First, we need to download Flutter SDK from the following site:
https://docs.flutter.dev/get-started/install/windows
Step 2 – extracting downloaded files
After downloading the file, right-click and extract it directly into C drive without going into any folder. It is a large file and will take some time.
Step 3 – Copy the bin folder address
Now go to C drive, ‘Flutter’ folder which you extracted will appear here. Open it and then go to the ‘bin’ folder which the path should be as under, just copy it:-
C:\flutter\bin
Step 4 – Add bin address in Path
Next we will go on the desktop and right-click on ‘this PC’ or ‘My Computer’ and go on properties. Then click on Advance System Settings. Now in this dialog box in the Advanced tab click on Environment Variables. Then in User Variables double click on Path and add new. Here you will paste C:\flutter\bin and then press Ok
Step 5 – How to install Android SDK
Now open Android Studio. Here you will need to install SDK component setup. To check this, click on three dots and open SDK Manager. If it is installed well, otherwise click on edit and download/ install it.
Step 6 – Installing Android SDK Command Line
Now in the same SDK Manager in the second tab i.e. SDK tools check whether Android SDK Command Line Tools is installed or not. If it is not installed check and install it.
Step 7 – In Command Prompt accepting licenses
Open the Command prompt (window +r then type cmd) and type flutter doctor. If you have done previous all steps accurately then you will see a checklist. The items with ticks are ok and those with crosses need to be addressed. Normally we have to only accept licenses here. For this purpose, we will type or copy past Flutter Doctor – android licenses in the command prompt. After that, by pressing y 5-6 times this step will also complete. We don’t need Visual Studio as we are using Android Studio. That’s it we have done installing SDK for Android Studio in Flutter.
How to install a plugin in Android Studio
We will now open Android Studio. We can install any plugin in Android Studio from the Plugin Tab. If we don’t install the Flutter plugin then we will install the Flutter plugin first. Only after that, we can create a new project.
How to create a new project
After that, in Projects, we will click on New Flutter Project. Now we will click on Flutter instead of Dart and will give Flutter SDK path which is in C i.e. C:\flutter. After that, we will click next and come in New Project.
New Project Settings
Here first we will give the first project name in small alphabets with underscore for example hello_world. Now we will make a folder named “Flutter” in our D drive or some suitable place. After that, we will give that location in Project Location. Please note we will have to add a project name at the end like \hello_world. In later projects, it will automatically come.
Description & Organization Option
In the description, we will add details regarding our project. It will help us in the future to recognize a project. In the project type, we will select Application. In Organization we need to add our app domain. It has to be unique and will be written inversely meaning ” com.facebook in lowercase. It is to remember that we can change it later but after creating and uploading it on playstore it cannot be changed.
Languages & Platforms
Next, we will select Kotlin and Swift languages. When we build an app it would be in that language so we don’t need to learn that language. Then in platforms check Android & iOS only as we are creating these apps. Now when we click on create a new project will be created.
How to run Flutter App in Android Studio Simulator
We run our Dart code on the console but when we do coding on Flutter it will be run on Android Studio Simulator. For this purpose we can enable debug mode in our Android phone and then by connecting it via USB or wifi we can do this. Though it requires a higher version of Android 12 or above. If we don’t have that we can create a virtual device but for this, we should have a faster laptop. Means i5 or i7 with at least 8 GB RAM. If we have that we can create it.
How to make the virtual device
To make a virtual device, we will click on the device manager tool on the right top of our flutter screen. Then we will select the device and screen size. After that, we will select the Android Version. If we don’t have then we will need to download it. It is a big file and may take hours to download but we need to download it only once so no worries. The next step is to give the device name and select portrait style.
Advance Settings of Virtual Device
We can also do advanced settings like the front camera off etc. Then we will assign it RAM storage like 1500 MB. Rest can be set as default settings and click on finish. That’s how we can create virtual devices. Now we can run our code on a virtual device. We can add as many devices as we like by following the previous steps. First time virtual device will take some time after that it will load instantly.
Alternatives of Flutter in Android Studio
Is there any alternatives After learning how to install SDK in Android Studio for Flutter If we are unable to install Flutter on Android Studio or need some time to do that. We can alternatively work on an online platform i.e. Flutlab.io till flutter installation. First, we go on the website and then will sign up using Google ID then log in. After that, we can create two projects in the free version which is enough for learning. It cannot compete with Android Studio but efficiently completes tasks.
How to create a flutter project on flutlab.io
After that, we will create a stateless project. We can also import from github means it will help in all manners. Then give a name to the project which should be like a dart name in small alphabets with underscore. There are tools on top for different work like running code on the web or emulator. With hot reload we can instantly view changes in an app by us. We can also download our project. In the Residents community, we can create posts to resolve issues. In the public data room, we will find templates like a login screen. We can see these templates for code guidance. We can run it on our Android phone as well. So it is a good alternative to Flutter in Android Studio.
Now we will start practically working in Flutter in the coming class after getting the answer of how to install SDK in Android Studio for Flutter. Don’t forget to practice all the above options and install Android Studio and Flutter. Best of luck !!