Android SDK cannot be found - flutter

When I run flutter doctor, this is what is says:
[✓] Flutter (Channel stable, 3.3.6, on macOS 12.1 21C52 darwin-arm, locale
en-CN)
[✗] 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/macos#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.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.71.1)
[✓] VS Code (version 1.72.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
I have downloaded android 12 from android studio, so I don't know what could be causing this problem. I didn't download it to a custom location, it is just sitting in my applications.
I tried looking for an answer on StackOverflow and online, but their problem is different from mine.

Use this code in the terminal: flutter config --android-sdk
For use the path where is your Android SDK located. In most cases it is "C:\Users\yourSystemUsername\AppData\Local\Android\Sdk"

First, find the location of your android SDK. If you cant, download again to custom location using SDK Manager from Android Studio.
My location looks like C:\src\Android\SDK
Now run the following command-> flutter config --android-sdk "sdk-location"
In my case, flutter config --android-sdk "C:\src\Android\SDK"
Your sdk file should look something like this

Related

when I start to run flutter doctor it say X Android SDK file not found: adb. how I solve this problem

C:\Users\ASUS>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19042.1526], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
X Android SDK file not found: adb.
[√] Chrome - develop for the web
[√] Android Studio (version 2021.1) ` `
[√] VS Code (version 1.64.2)
[√] Connected device (2 available)
! Doctor found issues in 1 category.
android_sdk/platform-tools/ is not installed in your computer or you made mistake in installing and adding to you path
if your using Android Studio go to settings then System Settings go to Android SDK and install Android SDK Platform-Tools,
if it didnt help reinstall platform-tools, this might be helpful
you can follow link to install it manually SDK Platform Tools
but remember to add the path of android bin folder in your env
for more info you can read this article
Go to SDK Manager from Settings.
Select Android SDK from Left Sidebar.
Select SDK Tools.
Check Android SDK Command-line Tools (latest) and download and
install it.
Run flutter doctor again
Hope solved

How to build a flutter environment

I'm new to flutter, and I'm trying to build a flutter environment on windows 11, but when I type flutter doctor even though I have android studio, I get an error like the one below. I would appreciate it if someone could tell me what's going on!
PS C:\> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.22000.376], locale ja-JP)
[✗] 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/windows#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.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[!] Android Studio
✗ android-studio-dir = C:\Program Files\Android\Android Studio
✗ Unable to find bundled Java version.
[✓] VS Code (version 1.62.3)
[✓] Connected device (2 available)
Brother PLz Apply All these instructions Given in the Link below, Your problem will be solved.
https://stackoverflow.com/questions/52014476/unable-to-locate-the-android-sdk/52018999#52018999

Flutter run: No supported devices connected error on Mac

I cannot seem to run my flutter project anymore. I created a new empty one and still the same: I get the same error
No supported devices connected.
The following devices were found, but are not supported by this project:
Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.192
If you would like your app to run on web, consider running flutter create . to
generate projects for these platforms.
It worked perfectly before! I used fluter doctor to check if everything is ok
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.2 20D80 darwin-arm, locale
en-GB)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
✗ Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[!] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.53.2)
[✓] Connected device (1 available)
I run my projects in VSCode and worked perfectly fine before... Flutter is put to date.
When I do flutterdeviced the IOS Simulator does not appear anymore :(
Accept licenses and try again. May be they changed agreement
run: flutter doctor --android-licenses
export PATH="$PATH://Users/USERNAME/dev/flutter/bin"
USERNAME= which user
dev = where flutter is
flutter doctor --android-licenses

flutter run -bash: Desktop/flutter/bin/flutter: No such file or directory

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.14.6 18G103, locale pl-PL)
[✗] 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/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[!] Android Studio (not installed)
[!] Connected device
! No devices available
I created a my_app folder and typed:
cd my_app
flutter run
The "flutter run" command does not work. How to fix this?
Have you installed android sdk?
If not then installing Android Studio will will install all the required dependencies.
I faced this problem it easy to solve
Open Android Studio
And go to preference
Plugins
Download flutter & dart
You need Android SDK, if you plan on using Android Studio then SDK will be downloaded with the Android Studio
https://developer.android.com/studio is the link to download

How to fix flutter doctor not recognizing Android mobile phone

I've connected Android Phone on my mac via USB. And flutter devices doesn't list my Phone.
I have enabled Developer options in my Phone and set up USB via MTP connection.
Is installing Android Studio a must ?
Here's output of 'flutter doctor'
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale
en-US)
[✗] 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/setup/#android-setup for detailed
instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
[!] Android Studio (not installed)
[✓] VS Code (version 1.35.1)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.```
Installing Android SDK (part of Android Studio) is a must. Flutter depends on Android SDK for developing android apps, but you need not use Android Studio as your IDE for flutter.
Or you can just install android-sdk if you don't want the complete Android Studio installation.