繁体   English   中英

flutter 找不到 android sdk?

[英]flutter can not find android sdk?

我已经在 ubuntu 18.04 上安装了 flutter 并且我还安装了 android 工作室,它工作正常,但是当我运行 Z5ACEBC4CB70DDBB074B0AC7AE Doctor flutter 找不到 android 工具链。 并且在dart插件和flutter插件之前也有红十字。 我不知道为什么会这样。 我也安装了 flutter 插件和 dart 插件。但红十字仍然存在。

这是flutter博士的出来

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, set
      ANDROID_SDK_ROOT to that location.
      You may also want to add it to your PATH environment variable.

如错误消息所述,您的环境变量中未设置ANDROID_SDK_ROOT或以前称为ANDROID_HOME

要解决此问题,您需要:

export ANDROID_SDK_ROOT=/path/to/android/studio/installation
export ANDROID_HOME=/path/to/android/studio/installation
export PATH=$PATH:/path/to/android/studio/installation

由于一些遗留原因,有一些变量指向同一件事。 为了确保您的 Flutter SDK 得到它,您可以设置所有这些。

注意:如果您不想在每次笔记本电脑重新启动时都设置它们,请随时将它们添加到~/.bashrc中。

理论上,在 Android Studio 的安装过程中,应该为您设置上述变量,但实际上并不总是发生,这就是您看到错误消息的原因。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM