You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 19.10无Android Studio配置Flutter:sdkmanager路径错误求助

Fixing Flutter's Android SDK Manager Path Issue on Ubuntu 19.10

Hey mateo, I’ve been in your exact situation before—setting up Flutter without Android Studio can be tricky with those path variables, but let’s get this sorted out step by step.

The Problem with Your Current Setup

You mentioned you set ANDROID_SDK_HOME and ANDROID_HOME to the direct path of sdkmanager, but that’s not right. These environment variables need to point to the root directory of your Android SDK, not the specific tool binary. That’s why Flutter still can’t find the sdkmanager tool.

Step 1: Correct Your Environment Variables

First, let’s update your shell configuration file (most likely ~/.bashrc for Ubuntu 19.10):

  1. Open the file in a text editor:
    nano ~/.bashrc
    
  2. Scroll to the bottom and add these lines (based on your description, your SDK root directory is /home/mateo/tools since your cmdline-tools are nested inside it):
    # Android SDK Configuration
    export ANDROID_SDK_ROOT=/home/mateo/tools
    export ANDROID_HOME=$ANDROID_SDK_ROOT  # For backward compatibility with older tools
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools
    
    • ANDROID_SDK_ROOT is the official recommended variable now, pointing to your SDK’s root folder.
    • Adding cmdline-tools/latest/bin to PATH lets your system (and Flutter) find the sdkmanager tool directly.
    • Including platform-tools ensures you can use adb and other essential tools later.

Step 2: Apply the Changes

Save the file (press Ctrl+O, then Enter in nano) and exit (Ctrl+X). Then run this command to make the changes take effect immediately:

source ~/.bashrc

If you use zsh instead of bash, replace .bashrc with .zshrc in both steps.

Step 3: Verify the Fix

  1. First, check if sdkmanager is now accessible:
    sdkmanager --version
    
    If this prints a version number, your path is set correctly.
  2. Next, run Flutter’s diagnostic tool to confirm it recognizes the SDK:
    flutter doctor
    
    You should no longer see the error about missing sdkmanager. If Flutter asks you to install additional components (like platform tools or build tools), you can use sdkmanager to install them directly, e.g.:
    sdkmanager "platform-tools" "build-tools;33.0.2"
    

Quick Note on SDK Structure

Double-check that your SDK folder structure looks like this:

/home/mateo/tools/
├── cmdline-tools/
│   └── latest/
│       ├── bin/
│       │   └── sdkmanager
│       └── ... (other cmdline-tool files)
└── (future folders like platform-tools, build-tools will go here)

If your cmdline-tools isn’t inside a latest subfolder, you might need to rename it—Flutter expects this structure to locate the tools correctly.

内容的提问来源于stack exchange,提问作者mateomotriz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 06:32:31