无法完成Flutter安装

huangapple go评论73阅读模式
英文:

Unable to complete Flutter installation

问题

我已安装了Flutter插件3.7.1到VS Code,以及Dart 3.7.1和其他两个与Android相关的插件。

当我运行Flutter Doctor命令时,它显示了3个问题之一是 - 未找到Android SDK。

所以,我从https://developer.android.com/studio/index.html#downloads下载了这个zip文件,并手动将tools文件夹放在这里 - C:\src\android_sdk\tools

tools文件夹中包含以下文件:

运行Flutter Doctor命令仍然显示相同的提醒。当我运行Create Android Emulator时,它显示错误 - Invalid argument(s): Cannot find executable for null.

我下载了正确的Android SDK包吗?

我不知道如何使用Java编程,因此希望继续使用VS Code。如何解决这些问题并开始使用Flutter?

我迄今为止尝试的步骤:

  1. 在“系统变量”中的“Path”变量中包含路径C:\src\android_sdk\tools
  2. 在“系统变量”中添加了变量ANDROID_HOME,其值为C:\src\android_sdk\tools
  3. 在Windows命令提示符中执行了以下命令,显示路径已更新,并且任何打开的编辑器都应重新启动才能生效:
C:\src\flutter\bin>flutter config --android-sdk C:\src\android_sdk\tools
C:\src\flutter\bin>flutter config --android-sdk "C:\src\android_sdk\tools"
C:\src\flutter>flutter config --android-sdk C:\src\android_sdk\tools
C:\src\flutter>flutter config --android-sdk "C:\src\android_sdk\tools"
  1. 下载了平台工具并提取了文件的内容到C:\src\android_sdk\tools\platform-tools\
  2. 按照这里ipereto的步骤,在PowerShell中运行了一个命令。它创建了platforms和platform-tool文件夹。
  3. 重新启动了系统。

在VS Code中运行flutter doctor仍然显示相同的错误。

更新:
Android Studio是Flutter工作所必需的。我错过了这一点。安装Android Studio后,需要在其中安装Flutter和Dart插件。
然后,VS Code中的flutter doctor命令不会显示这些错误。

英文:

I have installed the Flutter plugin 3.7.1 to VS code along with Dart 3.7.1, and two other Android related plugins.

When I run the Flutter Doctor command, it shows 3 issues and one of them is - Android SDK not found.

无法完成Flutter安装

So, I downloaded this zip file from https://developer.android.com/studio/index.html#downloads

无法完成Flutter安装

and manually placed the tools folder here - C:\src\android_sdk\tools

The tools folder has these files:

无法完成Flutter安装

Running the Flutter Doctor command still shows the same reminder. Also When I run Create Android Emulator, it shows the error - Invalid argument(s): Cannot find executable for null.

Did I download the correct Android SDK package.

I do not know how to code in Java and hence would like to stick with VS Code. How can I solve these issues and get started.

Steps I have tried so far:

  1. Included the path C:\src\android_sdk\tools for the Path variable in System Variables.

  2. Added the variable ANDROID_HOME in System Variables with the value C:\src\android_sdk\tools.

  3. Executed these commands in the Windows command prompt, which said - path updated and any open editor should be restarted to take effect:

    C:\src\flutter\bin>flutter config --android-sdk C:\src\android_sdk\tools
    C:\src\flutter\bin>flutter config --android-sdk "C:\src\android_sdk\tools"
    C:\src\flutter>flutter config --android-sdk C:\src\android_sdk\tools
    C:\src\flutter>flutter config --android-sdk "C:\src\android_sdk\tools"

  4. Downloaded the platform tools and extracted the contents of the
    file to C:\src\android_sdk\tools\platform-tools\

  5. Followed the step by ipereto here, which is to run a command in powershell. It created platforms & platform-tool folders.

  6. Restarted the system.

Running flutter doctor in VS code still shows the same error.

UPDATE:
Android Studio is a must for Flutter to work. I missed this point. After installing Android Studio, Flutter & Dart plugins are to be installed in it.
Then VS Code flutter doctor command did not show those errors.

答案1

得分: 3

看起来Flutter不知道要在哪里查找SDK。您是否更新了您的路径

英文:

It looks like Flutter doesn't know where to look for the SDK. Did you update your path ?

huangapple
  • 本文由 发表于 2020年1月3日 21:32:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579513.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定