[英]Unable to locate the Android SDK
I already had Android Studio and the Android SDK installed.我已经安装了Android Studio和 Android SDK。 I later added Flutter and the Flutter SDK.我后来添加了 Flutter 和 Flutter SDK。 Here is my problem: When I run这是我的问题:当我跑步时
flutter doctor
It shows,表明,
that I do not have the Android SDK installed.我没有安装 Android SDK。
You can configure the Android SDK for your project using您可以使用以下命令为您的项目配置 Android SDK
flutter config --android-sdk /path/to/android/sdk
The PATH
variable also should contain the SDK like PATH
变量还应包含 SDK,如
export PATH=$PATH:/usr/local/opt/android-sdk/emulator:/usr/local/opt/android-sdk/build-tools/26.0.1:/usr/local/opt/android-sdk/platform-tools:/usr/local/opt/android-sdk/tools
/usr/local/opt/android-sdk
and 26.0.1
might not match your system, that's just an example. /usr/local/opt/android-sdk
和26.0.1
可能与您的系统不匹配,这只是一个示例。
Locate the android SDK folder.(eg. D:\\SDK)找到 android SDK 文件夹。(例如 D:\\SDK)
Add platforms ( D:\\SDK\\platforms ) and platform-tools ( D:\\SDK\\platform-tools ) to the PATH variable.将平台( D:\\SDK\\platforms ) 和平台工具( D:\\SDK\\platform-tools ) 添加到 PATH 变量。
Run flutter doctor , it should not show any errors or warnings.运行flutter doctor ,它不应该显示任何错误或警告。
Step by Step guidance with picture带图片的分步指导
If you see this error, Its mean Flutter does not locate your ANDROID SDK.如果您看到此错误,则表示 Flutter 没有找到您的 ANDROID SDK。 There are two folder contain all files of "ANDROID SDK" are "Platform" and "Platform Tools"有两个文件夹包含“ANDROID SDK”的所有文件,分别是“Platform”和“Platform Tools”
There folder are locate in my computer Here C:\\Users\\ZohaibSaleem\\AppData\\Local\\Android\\Sdk (My name is Zohaib Saleem, you should replace my username folder name with your computer username)有文件夹在我的电脑里找到 C:\\Users\\ZohaibSaleem\\AppData\\Local\\Android\\Sdk(我的名字是 Zohaib Saleem,你应该用你的电脑用户名替换我的用户名文件夹名称)
Step 2第2步
Type "Env" in search bar of windows在窗口的搜索栏中输入“Env”
Click on "System Variable Environment"点击“系统变量环境”
Click on Advanced and Environment Variable点击高级和环境变量
Goto System Vairable -> Path -> Edit转到系统变量 -> 路径 -> 编辑
Now paste the path of both folder "platform" and "platform-tools" respectively.现在分别粘贴文件夹“platform”和“platform-tools”的路径。 In my case path are: C:\\Users\\ZohaibSaleem\\AppData\\Local\\Android\\Sdk\\platforms C:\\Users\\ZohaibSaleem\\AppData\\Local\\Android\\Sdk\\platform-tools在我的情况下,路径是:C:\\Users\\ZohaibSaleem\\AppData\\Local\\Android\\Sdk\\platforms C:\\Users\\ZohaibSaleem\\AppData\\Local\\Android\\Sdk\\platform-tools
After adding path your System variable look like:添加路径后,您的系统变量如下所示:
Click OK Restart PowerShell and again Run command "flutter doctor"单击确定重新启动 PowerShell 并再次运行命令“flutter doctor”
Now, Android SDK problem resolved, but you faced another problem现在,Android SDK 问题解决了,但您又遇到了另一个问题
For resolve this issue just run command flutter doctor --android-licenses and accept all with "Y".要解决此问题,只需运行命令 flutter doctor --android-licenses 并用“Y”接受所有内容。 At the end after typing multiple 'Y' again run' flutter doctor' and All set!最后在输入多个'Y'后再次运行'flutter doctor'和All set!
for this issue you have to add 3 variable to Path in the :对于此问题,您必须向 Path 添加 3 个变量:
C:\\Users\\admin\\AppData\\Local\\Android\\platforms
// the path to platform C:\\Users\\admin\\AppData\\Local\\Android\\platforms
// 平台路径
C:\\Users\\admin\\AppData\\Local\\Android\\platform-tools
// the path to platform-tool C:\\Users\\admin\\AppData\\Local\\Android\\platform-tools
// C:\\Users\\admin\\AppData\\Local\\Android\\platform-tools
的路径
C:\\Users\\Admin\\AppData\\Local\\Android\\emulator
// the path to emulator C:\\Users\\Admin\\AppData\\Local\\Android\\emulator
// C:\\Users\\Admin\\AppData\\Local\\Android\\emulator
的路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.