Install Flutter and Android Studio on Ubuntu 22.04

Ref: https://docs.flutter.dev/get-started/install/linux/android

Development tools

To develop Flutter on Linux:

1. Verify that you have the following tools installed: bash, file, mkdir, rm, which

2. Install the following packages: curl, git, unzip, xz-utils, zip, libglu1-mesa

3. To develop Android apps:
a. Install the following prerequisite packages for Android Studio.

b. Install Android Studio 2023.3.1 (Jellyfish) or later to debug and compile Java or Kotlin code for Android. Flutter requires the full version of Android Studio.
download and install the latest android studio from https://developer.android.com/studio

If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:

read the installation note on https://developer.android.com/studio/install#linux

Extract the downloaded file:

Move to the android-studio directory:

Run Android Studio:
Navigate to the bin directory and run the installer:

Use VS Code to install Flutter

To install Flutter using these instructions, verify that you have installed Visual Studio Code 1.77 or later and the Flutter extension for VS Code.

Prompt VS Code to install Flutter
#
Launch VS Code.
To open the Command Palette, press Control + Shift + P.
In the Command Palette, type flutter.
Select Flutter: New Project.
VS Code prompts you to locate the Flutter SDK on your computer.

 

If you have the Flutter SDK installed, click Locate SDK.
If you do not have the Flutter SDK installed, click Download SDK.

This option sends you the Flutter install page if you have not installed Git as directed in the development tools prerequisites.
When prompted Which Flutter template?, ignore it. Press Esc. You can create a test project after checking your development setup.

INSTALL CMAKE (ALSO FOR LINUX APP)
sudo apt install cmake

Launching lib/main.dart on Linux in debug mode…

CMake Error: CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

Error: Unable to generate build files

INSTALL NINJA BUILD
sudo apt install ninja-build

Launching lib/main.dart on Linux in debug mode…

CMake Error at /usr/share/cmake-3.22/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):

Could not find compiler set in environment variable CXX:

clang++.

Call Stack (most recent call first):

CMakeLists.txt:3 (project)

2

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

Error: Unable to generate build files

ALSO
satria@teddy:/opt/android-studio/bin$ sudo apt-get install \
clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev
BUT GOT

libbrotli-dev : Depends: libbrotli1 (= 1.0.9-2build6)
SOLUTION:

THEN RE-RUN:
satria@teddy:/opt/android-studio/bin$ sudo apt-get install \
clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev

Leave a Reply

Your email address will not be published. Required fields are marked *