No valid Android SDK platforms - flutter

When I write flutter doctor command in cmd I get this error.
No valid Android SDK platforms found in G:\SdkManager\platforms. Candidates were:
- android-21
- android-27
- android-28
- android-8.0.0
flutter doctor
env
path
flutter sdk
platforms
plugins

It appears as though this message shows up when you don't have any build-tools packages installed. At the time of writing, to install the minimum required versions, you can fix this issue with:
sdkmanager "platform-tools" "platforms;android-30" "build-tools;30.0.3"

I've set up my Android SDK manually on Windows 10 with the command line and I was able to solve this kind of errors while I tried to set up my development environment, if you want to solve it as I did, just follow the next steps that I posted in a GitHub Comment in a related issue:
https://github.com/flutter/flutter/issues/19805#issuecomment-478306166

You should download and install Android build tools for the respective platform versions. This can be done via the Android SDK Manager.

In AndroidStudio go to menu Tool > Android > SDK Manager
On the tab "SDK Platforms" select one or more platforms and click the OK button.
Wait until the download completed and try again.

Try to download all sdk from file-> settings -> sdkmanager.
And do not download manually.

Find your sdk path and execute the code.
$ flutter config --android-sdk <path-to-your-android-sdk-path>
see here

I think your path is incorrect in environment variable.
You should change it to G:/Sdkmanager/platforms

Related

Flutter doctor can't find Android SDK, but everything is set

I'm on Ubuntu 20.04 LTE
My Android SDK Location (shown in Android studio) is /home/myuser/Android/Sdk
The error goes as follows:
✗] 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, please use
`flutter config --android-sdk` to update to that location.
What I did to try to fix it:
Fresh installs of both Flutter (via snap) and Android studio (via apt, because when I install it also via snap, Flutter can't find even Android studio then).
Set configs:
flutter config --android-sdk="/home/myuser/Android/Sdk"
flutter config --android-studio-dir="/opt/android-studio-2021.1.1/android-studio"
Set paths in .bashrc:
export ANDROID_HOME=$HOME/Android/Sdk/
export PATH=$PATH:$ANDROID_HOME/tools/
export PATH=$PATH:$ANDROID_HOME/platform-tools/
In Android studio, I installed:
Dart and Flutter plugins.
SDK Platforms: 9.0(Pie), 10.0(Q), 11.0(R), 12.0(S), Android API 32
SDK Tools:
Android SDK Build-Tools 33-rc2
Android SDK Command-line Tools (latest)
Android Emulator 31.2.9
Android SDK PLatform-Tools 33.0.1
Trying to do flutter doctor --android-licenses doesn't do anything as it can't find Android SDK.
And I also can't run flutter doctor without adding sudo, because it stops after the first result and then runs for infinity.
Go to SDK tools and install all Support Repositories. Also check if there are any empty folders inside your SDK folder, if there are any empty folders, please delete them.Then follow the usual steps you mentioned,
Setting the config,
flutter config --android-sdk "/home/myuser/Android/Sdk"
Then finally run the flutter doctor again.
I use ubuntu too and the below is my environment.
Please try something like this in your vim ~./bashrc or vim ~/.zshrc
Change the paths as it is in your environment:
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
export PATH=$PATH:~/development/flutter/bin
if it doesn't work try installing Flutter manually:
https://docs.flutter.dev/get-started/install/linux#install-flutter-manually
As the error message says, ANDROID_SDK_ROOT or previously known as ANDROID_HOME are not set in your environment variables.
To fix that, you will need to:
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
Due to some legacy reasons, there are a few variables pointing to the same thing. To make sure your Flutter SDK is getting it, you can set all of them.
Note: if you don't want to set them every time your laptop reboots, feel free to add them into ~/.bashrc.
Theoretically, during the installation of Android Studio, the variables above should be set for you, but, in reality, it doesn't always happen which is the reason you are seeing the error message.
Not sure but maybe the problem is caused by snap, since it was sandboxing the applications you install. I remember having a problem like this on something different. You can try installing flutter manually (downloading the zip and so on...) rather than using snap.

i am getting an error in Android toolchain when i ran flutter doctor

I have started with the setup of flutter updated version and am a total beginner in this platform. This is the error I have been getting. Could you please help me?
You have to install Android SDK Command-line Tools (in SDK Manager).
After Installing, accept the android licensces (in CMD)
flutter doctor --android-licenses
Either install Android Studio to get the required dependecies or download an android sdkmanager and check its path (path/to/sdkmanager should be the path to that).
To avoid any problems for beginners, I would just install Android Studio here, set it up until it installs the android sdk, then switch to Flutter: that was the only way to fix this since some time ago if I remember correctly
Please first run this command
flutter doctor --android-licenses
then follow this link : Android/Sdk is missing a Tools folder, meaing no sdkmanager, meaning "Android license status unknown" error

flutter app could not locate aapt while building

When I was trying to build and run a flutter app it shows me the following message:
"Could not locate aapt. Please ensure you have the Android buildtools installed.
Exception: Problem building Android application: see above error(s)."
I already have both build tools and the android sdk installed, so I don't know what might have caused this issue.
Going into the folder where the android sdk is located and under the 'build-tools' delete everything inside it, then using android studio re install the build tools this will fix the issue
check in cmd flutter doctor
something like this will occur
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android SDK file not found: C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3\aapt.
problem is your sdk version 30.0.3 is not installed successfully
try to download it seperatelly from
https://androidsdkoffline.blogspot.com/p/android-sdk-build-tools.html?m=1
and unzip it and replace its contant with 30.0.3 at location C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3
restart
done
For me the issue was resolved by running flutter doctor in cmd. The issue was accepting licenses. Running flutter doctor --android-licenses and then typing y for all licenses resolved the issue.
You can use this command flutter config --android-sdk after updating the android studio and can refer to the path from SDK manager
I was able to generate apk but I was also unable to install the apk in device I removed the error by following steps-
go to C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3 (check show hidden items option)
delete this folder inside build-tools (because the error is not installed properly).
for resolving this issue, we have to uncheck all the latest plateforms (android (S)12 etc) and click apply after this restart the studio and check all these platforms again at least one latest and apply(ok).
Open Android Studio->files->Settings->Appearence & Behavior->System
Settings->Android SDK->SDK plateforms(Latest)
run flutter command to accept the licenses. (type Y then enter for all)
flutter doctor --android-licenses
all is done
It will be an Android Studio bug.
I updated Android Studio to the latest Beta version and fixed it.
I hope it will be of help to you too.
If you are using ubuntu check /home/username/Android/Sdk folder present or not, I think your sdk folder deleted or moved to new location. thats why this issue happen.
You must update your build tools of SDK by using SDK manager in android studio.
go to androidstudio->sdkmanager->sdktools->then update build tools
Delete uncompleted downloads in the "C:\Users\User\AppData\Local\Android\Sdk.downloadIntermediates" folder and reinstall the SDK build tools via the Android Studio's SDK manager.

Flutter doctor -android sdk file not found in platform/android-29

I have already install flutter and android studio, but when I executed flutter doctor ,
doctor found issues
android sdk file not found in path
( AppDate\local\android\sdk\platform\android-29\android.jar)
You can enter the Virtual devices manager in the Android Studio emulator, and download android SDK versions from it, you will have the download options, and then it will work.
Click here:
After here:
Select any Device:
Choose which android version to download.
This will install the desired versions.
AppDate\local\android\sdk\platform\android-29\android.jar
Go to this path and make sure files are not deleted.
Folder should have such files
If It is empty then install it!
open android studio goto File>Settings>Appearance and Behaviour>System Setting>Android SDK
Click on api 29 and download
Make sure android api 29 is installed

Flutter SDK Is Not Found In The Specified Location

I'm extremely frustrated right now after I updated Android Studio to have the latest Flutter and Dart Plugins. Now it tells me "No FLutter SDK configured" and when I give it the SKD path it just says, "Flutter SDK Is Not Found In The Specified Location." The Dart plugin works fine.
I have looked for an answer for hours and nothing works. I've downloaded the NDK, flutter doctor works perfectly, and I've tried set the SDK path to pretty much every file inside my flutter folder (inside /Documents).
Any tips?
Go to - Configure -> Tools > SDK Manager > Android SDK > SDK Tools, and search for flutter. You will get flutter SDK for Android.
If you are using Visual studio, also install plugins for flutter in Visual Studio.
» Steps:
Download Flutter SDK: Here
Extract Flutter:
tar xf ~/Downloads/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
Path export for particular terminal:
export PATH="$PATH:`pwd`/flutter/bin"
Permanent Path export:
Open bashrc file: Go to home directory terminal -> nano ~/.bashrc
Write at end of file:
export PATH=" [PATH_Where_Flutter SDK Extracted] /flutter/bin:$PATH"
example: export PATH="/home/sid/0_aaa_iauro/Flutter/s/flutter/bin:$PATH"
Run the following command to see if there are any dependencies you need to
install to complete setup:
flutter doctor -v
Add Flutter extension to vs-code.
Locate Flutter SDK.
Make New project in flutter:
flutter create Project_name
» Important Links:
Linux Install
Getting Started with Flutter on Linux for Android [Beginner Tutorial]
How To Install And Setup Flutter On Ubuntu 18.04.1 LTS (Bionic Beaver)
Part 2-A: Install Flutter in Windows – Step by Step Guide
Check for path variable (bashrc file):
Flutter – Step by Step Installation on Linux – Ubuntu
If you are using a fresh new Android Studio install as me, try installing missing packages for SDK support in Android Studio as described here: https://ladwhocodes.blogspot.com/2019/02/fix-flutter-sdk-not-found-in-specified-location.html
Go to Menu > Tools > SDK Manager > Android SDK (left side of the dialog) > SDK Tools (tab).
Select 'Support Repository' and 'NDK' checkboxes.
Click OK.
It will prompt you to install some dependencies. Install them.
What happen to me was because there is a space in my android sdk path (which is my username). I copy to C:\android\sdk and problem gone. Probably the space cause issue to NDK thus affect to Flutter sdk.
in my case, it was caused by local changes to the flutter git repo. On command line, everything worked, but in Android Studio it failed to detected the flutter sdk which caused all flutter commands to fail (even though flutter bin dir is in my path). The local changes were probably caused by trying out the beta version of flutter and returning to stable afterwards.
solution: delete flutter dir and redownload (I actually reverted all changes using the git clean command)