- Download Flutter
- Download Flutter
- Extract Downloaded Flutter SDK in a filder e.g. my case it is D:\installs\flutter_windows_3.27.3-stable\flutter
- Update "Path" environment variable to the flutter SDK bin folder D:\installs\flutter_windows_3.27.3-stable\flutter\bin
- Open new command prompt and run
- flutter doctor
- It will run the command possible with error of missing android tool chain etc, To create Android apps with Flutter, We need following android components be installed.
- Android SDK Platform, API 35.0.2
- Android SDK Command-line Tools
- Android SDK Build-Tools
- Android SDK Platform-Tools
- Android Emulator
- We will setup that now.
- Download Android Studio and Install with Default Configurations.
- After Installation Open Android Studio, in Welcome to Android Studio screen;
- Open More Actions
- SDK Manager
- Open SDK Platforms Tab
- Choose Android Version to install
- Apply
- It will Install Android SDK in AppData Local folder e.g. C:\Users\MY_USER\AppData\Local\Android\Sdk
- Open SDK Tools Tab, Select;
- Android SDK Build Tools
- Android SDK Command Line Tools
- Android Emulator
- Android Emulator hypervisor driver
- Android SDK platform-tools
- Apply & OK
- Open SDK Platforms Tab
Run;
- flutter doctor Every thing should be fine by now.
If you are working behind a proxy environment, you may face proxy issue. Set Environment Vairables http_proxy, https_proxy and NO_PROXY with proxy settings;
Run these commands or manually set environment variables
- set http_proxy="http://username:password@host:8080"
- set https_proxy="http://username:password@host:8080"
- set NO_PROXY="localhost,127.0.0.1,::1"
If Issue persists, try to set Proxy Settings in Flutter Config;
- flutter config --http-proxy="http://username:password@host:8080"
- flutter config --https-proxy="http://username:password@host:8080"
- flutter config --no-proxy="localhost,127.0.0.1"
Run flutter doctor and reconfirm.
- Edit "Path" environment variable and add;
- C:\Users\MY_USER\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
- it will make utility commands available in cmd like;
- sdkmanager
- apkanalyzer
- avdmanager
- You can try this command to test sdkmanager --licenses
- Edit "Path" environment variable and add;
- C:\Users\721\AppData\Local\Android\Sdk\platform-tools
- it will make "adb" command available in cmd. adb can be used for following commands;
- adb kill-server
- adb start-server
- adb devices (List Running Devices, Emulators + Physical)
Issue;
- I was getting error while selecting Device to run a flutter project. Proxy was set but that didn't work.
- Running flutter doctor was showing everything OK but Connected device list was always taking so much time and then give error.
- I tried with "adb devices" command, and command was never responding (No Error but not completingg too.)
- I tried with "adb kill-server" command to kill process manually. but this command was also never responding (No Error but not completingg too.)
- I killed adb from task manager. Then I tried with "adb start-server" command, and command was never responding (No Error but not completingg too.)
- In short Problem was with ADB. Spending 3 days, struggling to find issue, tried all possible solutions like proxy settings, reinstall every thing but didnt find reason.
- At Last, found the reason and issue was port conflict with some other process.
Solution adb runs on port 5037
- Run command netstat -ano | findstr :5037 and enlist processes listening on this port.
- If another process is using port 5037 (which adb uses), kill that process and restart adb.
- Close Android Studio and Apps and command prompts using Android SDKs.
- Run command taskkill /PID 5484 /F
- 5484 is example PID, replace it with your PIDs and kill all process.
- Close this Command prompt
- Open new command prompt
- KILL ALL PIDS AT ONCE ::COMMAND:: for /f "tokens=5" %a in ('netstat -ano ^| findstr :5037') do taskkill /PID %a /F
- Run commands
- adb kill-server
- adb start-server
- adb devices
To Fix PKIX Certificate Issue Add Proxy certificate in this path also along with installed JDK.
Run this command; It helps to see if any error
adb nodaemon server
Run this in CMD as Administrator:
netstat -aon | findstr :5037
You’ll get something like: TCP 127.0.0.1:5037 ... ... PID:1234
Now Run; tasklist | findstr 1234
→ That tells you which process is blocking ADB (e.g., antivirus, another adb, emulator, etc.). Open Task Manager and Kill that process.
After freeing the port, Restart ADB: adb kill-server adb start-server adb devices