As per Flutter documentation you should fulfill below requirement to run Flutter development environment on your machine.
- Operating Systems: Linux (64-bit)
- Disk Space: 600 MB (does not include disk space for IDE/tools).
- Tools: Flutter depends on these command-line tools being available in your environment.
bash
,mkdir
,rm
,git
,curl
,unzip
,which
Install Flutter SDK
1 |
$ cd ~/Documents |
Now run below command to extract the file in the current directory
1 |
$ tar xf ~/Downloads/flutter_linux_v0.3.2-beta.tar.xz<span style="font-size: 1rem;"> </span> |
1 |
export PATH=`pwd`/flutter/bin:$PATH |
This will temporarily add flutter to path, we need to make it permanent so that it will be available on restart also.
1 |
$ source $HOME/.bash_profile |
To check if it has been added to path
1 |
$ echo $PATH |
You should see the flutter path in the output.
Flutter comes with a handy doctor command through which you can see if all dependencies have been installed or not on your computer to run a flutter development environment.
1 2 3 4 5 6 7 8 9 10 11 |
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel beta, v0.3.2, on Linux, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3) [✓] Android Studio (version 3.1) ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. [✓] VS Code (version 1.23.1) [!] Connected devices ! No devices available ! Doctor found issues in 1 category. |
You can upgrade flutter by running
1 |
$ flutter upgrade |
Setup Android Studio
You should have android studio installed on your machine. To install the latest version of it, visit https://developer.android.com/studio/
Configure Text Editors
Refer this link to setup Flutter in Android Studio –
https://flutter.io/get-started/editor/#androidstudio
To setup flutter in Visual Studio Code, refer this link
https://flutter.io/get-started/editor/#vscode
Setup Device to run the application (From flutter.io)
To prepare to run and test your Flutter app on an Android device, you’ll 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. - Start your app by running
flutter run
.
By default, Flutter uses the version of the Android SDK where your adb
tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_HOME
environment variable to that installation directory.
Set up the Android emulator
To prepare to run and test your Flutter app on the Android emulator, follow these steps:
- Enable VM acceleration on your machine.
- Launch Android Studio>Tools>Android>AVD Manager and select Create Virtual Device.
- Choose a device definition and select Next.
- Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
- Under Emulated Performance, select Hardware – GLES 2.0 to enable hardware acceleration.
- Verify the AVD configuration is correct, and select Finish.For details on the above steps, see Managing AVDs.
- In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.
- Start your app by running
flutter run
. The connected device name isAndroid SDK built for <platform>
, where platform is the chip family, such as x86.