英文:
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?
我迄今为止尝试的步骤:
- 在“系统变量”中的“Path”变量中包含路径
C:\src\android_sdk\tools
。 - 在“系统变量”中添加了变量
ANDROID_HOME
,其值为C:\src\android_sdk\tools
。 - 在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"
- 下载了平台工具并提取了文件的内容到
C:\src\android_sdk\tools\platform-tools\
。 - 按照这里的ipereto的步骤,在PowerShell中运行了一个命令。它创建了platforms和platform-tool文件夹。
- 重新启动了系统。
在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.
So, I downloaded this zip file from https://developer.android.com/studio/index.html#downloads
and manually placed the tools
folder here - C:\src\android_sdk\tools
The tools folder has these files:
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:
-
Included the path
C:\src\android_sdk\tools
for thePath
variable inSystem Variables
. -
Added the variable
ANDROID_HOME
in System Variables with the valueC:\src\android_sdk\tools
. -
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"
-
Downloaded the platform tools and extracted the contents of the
file toC:\src\android_sdk\tools\platform-tools\
-
Followed the step by ipereto here, which is to run a command in powershell. It created platforms & platform-tool folders.
-
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 ?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论