How to Set Up a Flutter Development Environment Directly on Android Using Termux (No Root)

17 min read Learn step‑by‑step how to install Flutter, the Android SDK, and all required tools inside Termux so you can develop and test Flutter apps directly on your Android phone without rooting. October 07, 2026 20:00 How to Set Up a Flutter Development Environment Directly on Android Using Termux (No Root)

Why Run Flutter Directly on Your Android Phone?

Most Flutter developers use a PC or Mac as the host machine and connect an Android device for testing. That workflow works well, but it ties you to a separate computer, consumes extra power, and adds a layer of dependency on USB cables or Wi‑Fi ADB. With Termux – a Linux‑like terminal environment that runs on Android without root – you can turn the phone itself into a full‑featured development workstation.

Running Flutter on the device gives you:

  • Portability: Carry your code, tools, and emulator‑like testing environment in your pocket.
  • Instant feedback: No need to push builds over ADB; flutter run compiles and launches directly on the same device.
  • Learning value: Understanding how the Android SDK, Java, and Gradle work under the hood.

This tutorial assumes you have a relatively recent Android version (Android 10 or newer) and at least 4 GB of free internal storage. The steps work on most ARM64 devices; for 32‑bit devices replace aarch64 with arm where indicated.

Before You Start

Make sure your device is fully charged (or keep it plugged in) and connected to a stable Wi‑Fi network. The installation will download several hundred megabytes.

  • Enable Developer options → USB debugging. This is not strictly required for the tutorial but helps if you later want to use ADB from the same device.
  • Give Termux permission to access storage: open Termux and run termux-setup-storage. Accept the Android prompt.
  • Reserve at least 2 GB of free space in the internal storage for the Android SDK and Flutter cache.

Step 1 – Install Termux and Update Its Packages

  1. Install Termux from F‑Droid (the official source) to avoid the outdated Play Store version.
  2. Open Termux and run the following commands to update the package repository and upgrade existing packages:
    pkg update && pkg upgrade -y
  3. Install basic utilities that will be used later:
    pkg install -y git curl wget unzip zip tar proot-distro

Termux now provides a Debian‑like environment where we can install the Java runtime, Android command‑line tools, and Flutter itself.

Step 2 – Install OpenJDK (Java Development Kit)

Flutter’s Android toolchain relies on Java 11 (or newer). Termux offers OpenJDK packages that work well on ARM64.

  1. Install OpenJDK 17 (the most recent LTS version available in Termux):
    pkg install -y openjdk-17
  2. Verify the installation:
    java -version
    You should see something like openjdk version "17.x.x".

If the command reports command not found, repeat the pkg install step and ensure your PATH includes $HOME/.local/bin (Termux adds it automatically).

Step 3 – Install the Android SDK Command‑Line Tools

The Android SDK provides the adb, sdkmanager, and other utilities that Flutter uses to compile and sign apps.

  1. Create a directory for the SDK inside your home folder:
    mkdir -p $HOME/Android/sdk
  2. Download the latest command‑line tools package for Linux (the ARM64 build works on Android because it runs the same ELF format). Use wget:
    wget -O cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
  3. Unzip the archive into the SDK directory:
    unzip cmdline-tools.zip -d $HOME/Android/sdk/cmdline-tools
  4. Rename the extracted folder to latest so that sdkmanager can find it:
    mv $HOME/Android/sdk/cmdline-tools/* $HOME/Android/sdk/cmdline-tools/latest
  5. Add the SDK tools to your PATH (add these lines to ~/.bashrc or ~/.zshrc):
    export ANDROID_SDK_ROOT=$HOME/Android/sdk
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools
    Then source the file:
    source ~/.bashrc
  6. Accept the Android SDK licenses:
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platforms;android-33" "build-tools;33.0.2" "platform-tools" --licenses
    Type y when prompted.

At this point adb and sdkmanager should be callable from the terminal.

Step 4 – Install Flutter SDK Inside Termux

Flutter provides a pre‑compiled Linux binary that runs perfectly in Termux’s Linux environment.

  1. Navigate to a folder where you want to keep Flutter (e.g., $HOME/development):
    mkdir -p $HOME/development && cd $HOME/development
  2. Download the latest stable Flutter SDK for Linux (ARM64). As of the time of writing the URL is:
    wget -O flutter_linux.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.22.0-stable.tar.xz
    Note: Replace the version number with the most recent stable release if you wish; the URL pattern stays the same.
  3. Extract the archive:
    tar xf flutter_linux.tar.xz
  4. Add Flutter to your PATH (append to ~/.bashrc):
    export PATH=$PATH:$HOME/development/flutter/bin
    Then reload:
    source ~/.bashrc
  5. Run flutter doctor to let Flutter download additional components:
    flutter doctor
    The first run will fetch the Dart SDK and set up the Android toolchain. Follow any prompts to accept licenses.

If flutter doctor reports missing components, run the suggested commands. Typical missing items are the Android SDK (already installed) and the Java version (already set up).

Step 5 – Verify the Complete Toolchain

Run flutter doctor -v for a verbose report. A healthy setup should show:

  • Flutter (channel stable, version …)
  • Dart SDK (version …)
  • Android toolchain – Java version 17, Android SDK location, and adb found.
  • No errors or warnings.

If you see a warning about Android licenses not accepted, re‑run the sdkmanager --licenses command from Step 3.

Step 6 – Create and Run Your First Flutter App

Now that the environment is ready, let’s build a tiny “Hello World” app and launch it on the same device.

  1. Create a new project:
    flutter create hello_flutter
  2. Enter the project directory:
    cd hello_flutter
  3. Because we are compiling for the device we are already on, we need to enable “device‑side” debugging. Install the android-tools package (which provides adb) if you haven’t already:
    pkg install -y android-tools
  4. Start the ADB server and let it recognize the same device (Termux sees the device via the same Android framework):
    adb start-server
    adb devices
    The output should list a device with the word device next to it. If it shows offline or nothing, make sure USB debugging is enabled and that Termux has the android.permission.USB_PERMISSION (granted automatically when you enable USB debugging).
  5. Run the app directly on the device:
    flutter run
    Flutter will compile the Dart code, invoke Gradle to build an APK, install it, and launch the app. You should see the familiar “Hello world” screen.

Congratulations – you have just compiled and executed a Flutter app without ever leaving your phone.

Step 7 – Optional: Enable Hot‑Reload Over the Same Device

One of Flutter’s biggest productivity boosts is hot‑reload. While the app is running, you can edit lib/main.dart with any editor (e.g., vim or nano inside Termux) and press r in the terminal to inject the changes instantly.

Example:

vim lib/main.dart

Change the text inside Text('Hello world') to something else, save, then press r in the running flutter run session. The UI updates without a full rebuild.

Step 8 – Managing Project Dependencies and Build Caches

Flutter stores downloaded packages in $HOME/.pub-cache and build intermediates in build/ inside each project. Over time these can consume several gigabytes.

  • To clear the pub cache: flutter pub cache repair (re‑downloads only needed packages).
  • To clean a project’s build output: flutter clean.
  • If storage becomes tight, you can move the cache to external storage and point Flutter to it:
    export PUB_CACHE=/sdcard/flutter_pub_cache
    Remember to add the export line to your ~/.bashrc.

Troubleshooting Common Issues

1. java.lang.OutOfMemoryError during Gradle build

Termux runs on limited RAM. If the Gradle daemon crashes with an OOM error, increase the heap size for the daemon:

export _JAVA_OPTIONS="-Xmx1024m"
flutter clean && flutter run

Adjust 1024m based on your device’s RAM (e.g., 2048m for a 6 GB device).

2. adb: command not found

Make sure the android-tools package is installed and that $HOME/Android/sdk/platform-tools is in your PATH. Re‑source your shell configuration or restart Termux.

3. Gradle version mismatch

Flutter pins a specific Gradle wrapper version. If you see a message about an unsupported Gradle version, delete the gradle/wrapper/gradle-wrapper.properties file and let Flutter regenerate it by running flutter pub get again.

4. “Unable to locate Android SDK”

Double‑check that ANDROID_SDK_ROOT points to the directory created in Step 3 ($HOME/Android/sdk) and that the platform-tools sub‑folder exists.

5. Build fails with “Could not resolve all files for configuration ':app:debugCompileClasspath'”

This usually means the device cannot reach Google’s Maven repository. Ensure you have a working internet connection, then run:

flutter pub cache repair
flutter clean
flutter run

Performance and Practical Limits

Compiling Flutter apps is CPU‑intensive. On low‑end devices (e.g., 1 GB RAM, older Snapdragon), a full build may take several minutes. For rapid iteration, rely on hot‑reload as much as possible and keep the codebase small.

Running the Android emulator inside Termux is not feasible; you are limited to the physical device you are using. If you need to test multiple screen sizes, consider using responsive layout techniques inside your Flutter code.

Edge Cases and Alternative Paths

  • 32‑bit devices: Replace openjdk-17 with openjdk-11 (the last version available for 32‑bit). The Flutter binary still works because it is compiled for x86_64; you must use the flutter_linux_3.22.0-stable.tar.xz “linux‑x64” build, which runs under proot‑distro. The tutorial above assumes ARM64; for 32‑bit you would need to run an x86 chroot, which is beyond the scope of this guide.
  • Using a different Flutter channel: After installation you can switch channels with flutter channel beta followed by flutter upgrade. The steps remain the same.
  • External storage for SDK: If internal storage is scarce, move the Android/sdk folder to an SD card and update ANDROID_SDK_ROOT accordingly.

Cleaning Up When You’re Done

If you ever need to free up space or start fresh:

  1. Delete the Flutter directory:
    rm -rf $HOME/development/flutter
  2. Remove the Android SDK (be careful if you use it for other projects):
    rm -rf $HOME/Android/sdk
  3. Uninstall Termux packages you no longer need:
    pkg uninstall openjdk-17 android-tools git curl wget unzip zip tar proot-distro

All user data (your Flutter projects) remain in whatever folder you created (e.g., $HOME/development/hello_flutter) unless you delete them explicitly.

Wrap‑Up

By following the steps above you have transformed an ordinary Android phone into a self‑contained Flutter development workstation. The process leverages Termux’s Linux environment, open‑source command‑line tools, and Flutter’s own cross‑platform SDK. While the build times on a phone are slower than on a desktop, the convenience of coding, testing, and iterating without a separate computer can be a game‑changer for learning, quick prototyping, or working while traveling.

Feel free to explore further: integrate Git for version control, install a lightweight editor like micro or vim, and experiment with Flutter plugins that access device sensors directly from your Termux‑based setup. Happy coding!

User Comments (0)

Add Comment
We'll never share your email with anyone else.