Arch 上的 Flutter Doctor 出现问题 Linux

Having a problem with Flutter Doctor on Arch Linux

我是 运行 Arch Linux。

我有一个问题,flutter doctor 无法识别我的 Android Sdk。

我的 Flutter Doctor 输出:

[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, locale en_US.UTF-8)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[✓] Android Studio
[!] Connected device
    ! No devices available
[✓] HTTP Host Availability

! Doctor found issues in 3 categories.

这里有更详细的总结:

[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, locale en_US.UTF-8)
    • Flutter version 2.10.3 at /home/tt/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2021.1)
    • Android Studio at /home/tt/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401
    • Flutter plugin version 65.2.2
    • Dart plugin version 211.7808
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] Android Studio
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[!] Connected device
    ! No devices available

[✓] HTTP Host Availability
    • All required HTTP hosts are available

如您所见,它无法识别我的 Android SDK。 我试过这个:

flutter config --android-sdk /home/tt/Android/Sdk/platforms/android-32/android.jar

我得到了:

Setting "android-sdk" value to "/home/tt/Android/Sdk/platforms/android-32/android.jar".

You may need to restart any open editors for them to read new settings.

我 运行 flutter doctor 但没用。我重启了我的机器,还是不行。

我已经从工具箱应用程序中获得了 Android Studio。我尝试从 .tar.gz 版本安装它。还是不行。我从 AUR 安装,但没有任何效果。

你能帮忙吗..

尝试在您的环境变量中设置 ANDROID_HOME。

在 ~/.bashrc 中你使用的是 bash 或 ~/.zshrc 如果你在最后一行中使用 zsh put

export ANDROID_HOME=[SDK-PATH]
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools