I already had Android Studio and the Android SDK installed. I later added Flutter and the Flutter SDK. Here is my problem: When I run
flutter doctor
It shows,
that I do not have the Android SDK installed.
You can configure the Android SDK for your project using
flutter config --android-sdk /path/to/android/sdk
The PATH
variable also should contain the SDK like
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.
Locate the android SDK folder.(eg. D:\\SDK)
Add platforms ( D:\\SDK\\platforms ) and platform-tools ( D:\\SDK\\platform-tools ) to the PATH variable.
Run flutter doctor , it should not show any errors or warnings.
Step by Step guidance with picture
If you see this error, Its mean Flutter does not locate your ANDROID SDK. There are two folder contain all files of "ANDROID SDK" are "Platform" and "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)
Step 2
Type "Env" in search bar of windows
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. In my case path are: 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"
Now, Android SDK problem resolved, but you faced another problem
For resolve this issue just run command flutter doctor --android-licenses and accept all with "Y". At the end after typing multiple 'Y' again run' flutter doctor' and All set!
for this issue you have to add 3 variable to Path in the :
C:\\Users\\admin\\AppData\\Local\\Android\\platforms
// the path to platform
C:\\Users\\admin\\AppData\\Local\\Android\\platform-tools
// the path to platform-tool
C:\\Users\\Admin\\AppData\\Local\\Android\\emulator
// the path to emulator
flutter config --android-sdk /your path
example
flutter config --android-sdk /root/Android/Sdk
Tools > SDK Manager > Android SDK
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.