Flutter does not find android sdk

前端 未结 25 2135
花落未央
花落未央 2020-12-02 09:29

I just tried intalling flutter and since I already had android studio and the android sdk installed I just followed the installation of flutter. Here is my problem: When I r

25条回答
  •  醉梦人生
    2020-12-02 10:12

    Choose the folder to install (I called it BASE_PATH) and use the following commands to install SDK with flutter:

    Install SDK

    cd $BASE_DIR
    mkdir android-sdk
    cd android-sdk
    wget https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
    unzip commandlinetools-linux-6200805_latest.zip
    ./tools/bin/sdkmanager --sdk_root=$(pwd) "build-tools;28.0.3" "emulator" "platform-tools" "platforms;android-28" "tools"
    

    I used a separate folder for SDK, because it will add parent folders.

    Install Flutter

    cd $BASE_DIR
    wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.8-stable.tar.xz
    tar xvf flutter_linux_v1.12.13+hotfix.8-stable.tar.xz
    

    Export Vars (you can add them to your .bashrc)

    export ANDROID_SDK=$BASE_DIR/android-sdk
    export ANDROID_PATH=$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
    export FLUTTER=$BASE_DIR/bin
    export PATH=$PATH:$ANDROID_PATH:$FLUTTER
    

    Check!

    flutter doctor
    
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel beta, v1.12.13, on Linux, locale en_US.UTF-8)
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    [!] Android Studio (not installed)
    [✓] VS Code (version 1.31.1)
    [!] Connected device
        ! No devices available
    
    ! Doctor found issues in 2 categories.
    

提交回复
热议问题