How to Install and Configure Flutter Without Android Studio


I prefer Visual Studio Code and don't want to install Android Studio if I'm not going to use it. Flutter, on the other hand, need the installation of  Android Studio to get essential Android dependencies. But, if you're like me and don't want to install Android Studio, this is the place to be. This tutorial will walk you through the steps needed to install and run Flutter without having to download Android Studio.

Official Guide: Linux Install - Flutter

Note: This has been tested on Ubuntu 21.04 and the commands are applicable for linux. This guide also assumes that you are comfortable with command-line navigation and common commands. For other platforms, use platform-specific tools.

1. Get the Flutter SDK

You can get the Flutter SDK by two ways.

    a. Using Snapd

    You can download from the snap store, or from the command-line:

    b. Download SDK Manually

    You can download the SDK manually from here.
    After downloading completes, extract it to your home directory.
    Navigate to your home directory and run the following command to create /.bash_profile file:
    And paste the following lines to add flutter to the PATH:
    Now run the following commands and wait for Flutter to download some dependencies:
    You will see output something like this(ignore the Android Toolchain issue for now):

2. Download OpenJDK8

Run this command to install OpenJDK8:
Now, open the /.bash_profile file we created earlier and add the following lines to add OpenJDK8 to the PATH:

3. Download sdkmanager

Head over to Download Android Studio and SDK tools and scroll down to find 'Command line tools only' and download commandlinetools for your platform and extract in your home directory inside a subfolder android-sdk.
Now navigate to the android-sdk folder and inside commandline-tools, create a subdirectory latest and move all the contents of the commandline-tools into that new directory latest.
Now, open the /.bash_profile and add the following lines to add sdkmanager to the PATH:

4. Install Android Dependencies

Run the following commands to download and install android dependencies:

5. Add Android-SDK to the PATH

Open /.bash_profile and add the following lines to add Android-SDK to the PATH:

6. That's it !

Restart your PC and run flutter doctor and you will get an output like this:

Open Visual Studio Code or any IDE of your choice and download Dart and Flutter Plugin and you're good to go.

Comments

  1. how about run with emulator if we didnt install andoid studio?

    ReplyDelete
    Replies
    1. Run the following commands:

      This will download Api-30(A11) image:
      sdkmanager ""system-images;android-30;google_apis;x86""
      To accept the license:
      sdkmanager --licenses
      To create your avd(Android Virtual Device):
      avdmanager create avd -n "Name of your avd" "system-images;android-30;google_apis;x86"
      To list all your avds:
      avdmanager list avd
      To run the avd:
      emulator -avd "Name of your avd"

      Delete

Post a Comment

Any criticism or suggestions are appreciated!