Create a basic flutter project in Android Studio

Android Studio and flutter :

You can build flutter apps using flutter command line tools with any text editor. However, if you want to get other development helpers like syntax highlighter, widget editing, auto completion, debugging etc., you should consider using one of the editor plugin that is provided by Google for Android studio, VS Code and Intellij-Idea.

In this post, I will show you how you can build your first flutter app on Android Studio.

Installing Flutter plugin on Android Studio :

If you don’t have android studio, download and install it from here(https://developer.android.com/studio).

  1. Start it.

  2. Go to the ‘Preferences’ tab. (File -> Settings on windows , Android Studio -> Preferences on mac)

  3. Search for ‘plugin’ and click on the plugin tab on left side.

  4. Under the Marketplace tab, search for flutter.

  5. Install it. If it prompt to install dart, install that as well.

  6. Restart android studio when prompted.

flutter android studio install

Create your first app :

  1. Open your Android Studio and click on Start a new flutter project.

android studio start new flutter project

  1. Check Flutter application and click on Next.

android studio flutter project 2

  1. Add your project location and project name. Make sure that flutter sdk is installed and its sdk path is correct. If not, you can install it using the button Install SDK.

android studio flutter create project

  1. Click next and add one package name for your application. This package name is unique for each application. Don’t worry about that now. You can change it later before releasing it on play store. Click on Finish and done. It will start creating your flutter app.

android studio flutter package

Running your app :

You need to connect your mobile to your pc or start one new android virtual device from tools -> AVD. Select your phone or emulator, select the configuration as main.dart, and click on the play button to start the app :

flutter run

It will start the app on your emulator or your phone :

flutter emulator

Click on the plus button to increment the value of the number.

Hot reloading :

Flutter provides hot reloading. That means, you can change a part of your code and reload the app quickly without rebuild and install it again. Open your lib/main.dart, change primarySwatch: Colors.blue, to primarySwatch: Colors.red, and click on the hot reload button :

flutter hot reload button

It will reload the app quickly and change its color.

That’t it for now. You have learned how to setup android studio and how to create one simple flutter application using predefined template. Try to change different text and colors in lib/main.dart and see how it looks.