Flutter ios build fails. simulator builds also fail - flutter

I've been working on an app for months now and using Flutter, but whenever I upgrade Flutter, it is a huge pain because I have to wrestle to try to get it to build again. Usually manually cleaning up CocoaPods and pubspec.yaml is enough, but this time it hasn't.
I've upgraded my Flutter version to 1.14.6 from 1.10.7, nuked my pods and pubspec.yaml, nuked my installation of Flutter, my repository, and nothing worked.
Another weird thing about it is that I have the build running just fine with the same versions of flutter, dart, cocoapods, and ruby on the same branch on a different machine. Is there something cached somewhere that I am not cleaning up properly? When I try to build, it says it fails with errors, but unfortunately the log output doesn't actually show any errors, and only shows warnings. Here is a part of my log output:
8 warnings generated.
/Users/hallo/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:13: warning: unused variable 'sourceApplication' [-Wunused-variable]
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
^
/Users/hallo/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:41: warning: 'UIApplicationOpenURLOptionsSourceApplicationKey' is only available on iOS 9.0 or newer [-Wunguarded-availability]
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In module 'UIKit' imported from /Users/hallo/Documents/HalloMonoRepo/hallo/ios/Pods/Target Support Files/google_sign_in/google_sign_in-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:514:51: note: 'UIApplicationOpenURLOptionsSourceApplicationKey' has been marked as being introduced in iOS 9.0 here, but the deployment target is iOS 8.0.0
UIKIT_EXTERN UIApplicationOpenURLOptionsKey const UIApplicationOpenURLOptionsSourceApplicationKey NS_SWIFT_NAME(sourceApplication) API_AVAILABLE(ios(9.0)); // value is an NSString containing the bundle ID of the originating application; non-nil if the originating application and this application share the same team identifier
^
/Users/hallo/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:41: note: enclose 'UIApplicationOpenURLOptionsSourceApplicationKey' in an #available check to silence this warning
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could not build the application for the simulator.
Error launching application on iPhone 8.
Any help would be much appreciated as I have exhausted my ideas on what could be causing this error.
Pluto:hallo hallo$ flutter doctor -v
[✓] Flutter (Channel beta, v1.14.6, on Mac OS X 10.14.6 18G3020, locale en-US)
• Flutter version 1.14.6 at /Users/hallo/Documents/dev/flutter
• Framework revision fabeb2a16f (3 weeks ago), 2020-01-28 07:56:51 -0800
• Engine revision c4229bfbba
• Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/hallo/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.42.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.8.1
[✓] Connected device (1 available)
• iPhone 8 • C40DD8DB-5860-4B94-8D20-372074B6E7BC • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
• No issues found!`

Are you running on Android Studio? VS Code? Could you post your flutter doctor -v?
Other than that, all those errors comes from google_sign_in. Would recommend the following:
Remove google_sign_in (and comment any screens using this dependency)
Make sure you're following all the correct changes inside your iOS Folder
Use a different library. google_sign_in may not be up to date with all the latest Flutter changes.
If your code runs without that library, it clearly shows an error with the latest upgrade changes.

I fixed the issue by changing a variety of things. When I did the flutter upgrade, it changed my project.pbxproj file by adding this line
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${PODS_ROOT}/Fabric/run\"\n";
which caused a lot of errors. I deleted this line, changed the build system in Xcode to default (it was legacy), and then in the embed frameworks in Xcode, I removed Flutter.framework.

Just run flutter clean on your project, it did the trick for me.

Related

Flutter / Dart syntax highlighting is not working

The syntax of the dartcode in my flutter project is no longer being highlighted and cannot click the declarations or do autocomplete of code, like typing: StreamBuilder( and then click enter to create the widget for a streambuilder.
See example code below, where normaly, the different elements would be coloured:
This problem occured after I installed intelliJ, I did this because I needed to write some javascript for firebase functions.
Tried this so far, with no luck:
deleting android studio and re-install it.
invalidate caches and restart.
restart analyses server
checked that dart and flutter has the right paths under 'languages & frameworks'
created a new flutter project, here everything works just fine. but if i copy in my codebase the issue persists
Im using android studios latest version.
EDIT:
Apparently I have some issues after all with the plugins. But as seen in the picture, I've given the paths to both flutter and dart.
Its somehow related to intelliJ because when i click the links from the flutter doctor output it takes me to jetbrains website
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.3 20E232 darwin-x64, locale da-DK)
• Flutter version 2.2.3 at /Users/jeffmayn/Desktop/Development/flutter
• Framework revision f4abaa0735 (10 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/jeffmayn/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 15.0.1+9-18)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.63
! Doctor found issues in 2 categories.
Process finished with exit code 0
I think reinstalling Flutter and Dart plugin to Android Studio can help. Syntax highlighting is plugins' job.
The solution of yoppuyoppu worked for me, but as he mentioned, only for the selected files.
So here is a small addition that makes it work for all .dart files:
In the "Register New File Type Association" window you can change the File pattern to "*.dart".
And of course select Dart as shown.
That way all files ending with ".dart" will be associated with Dart.
In my case, only one file had such problem. And it turned out I screwed up the file type association of the file when I created it.
Fix was to reassociate the file with Dart.
Go to the menu bar >> File >> File Properties >> Associate with File Type...
And in the dialog that follows, pick Dart and click OK.
You can choose as many files as you like at any one time.
None of the suggested solutions worked out for me. What I did was then:
create a new flutter project.
setup dart and flutter plugins.
copy in all my code, files, assets, etc. from the old project to the new.

Flutter: Cant build app anymore since upgrade flutter and channel

Please help me!
The app was close to be finished and since I did run flutter upgrade to solve a bug I had to run:
flutter clean
flutter channel master
flutter upgrade
flutter run
and now its not starting anymore and the following code shows up..
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 7,6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/patrickmeyer/AndroidStudioProjects/my_fitness_challenge/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/GDTCORPlatform.m:140:55: error: 'currentRadioAccessTechnology' is deprecated: first deprecated in iOS 12.0 [-Werror,-Wdeprecated-declarations]
networkCurrentRadioAccessTechnology = networkInfo.currentRadioAccessTechnology;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
serviceCurrentRadioAccessTechnology
In module 'CoreTelephony' imported from /Users/patrickmeyer/AndroidStudioProjects/my_fitness_challenge/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORPlatform.h:32:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:154:61: note: 'currentRadioAccessTechnology' has been explicitly marked deprecated here
#property (nonatomic, readonly, retain, nullable) NSString* currentRadioAccessTechnology API_DEPRECATED_WITH_REPLACEMENT("serviceCurrentRadioAccessTechnology", ios(7.0, 12.0)) API_UNAVAILABLE(macos);
^
1 error generated.
PromisesObjC-crewhghtjvlepwbqltmbxkeqlsao
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
My flutter doctor looks good...
[✓] Flutter (Channel master, 1.26.0-2.0.pre.117, on Mac OS X 10.15.7 19H114
darwin-x64, locale de-DE)
• Flutter version 1.26.0-2.0.pre.117 at
/Users/patrickmeyer/Developer/flutter
• Framework revision 15c009b805 (17 hours ago), 2020-12-22 20:09:03 -0500
• Engine revision b7cd3f8e70
• Dart version 2.12.0 (build 2.12.0-173.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/patrickmeyer/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • 11ACA273-A0C3-405D-993A-A9AF9057887C • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
• Chrome (web) • chrome •
web-javascript • Google Chrome 87.0.4280.88
• No issues found!
This could be because of compatible issues between flutter and Xcode version. Switch to the previous version and see if the error is there. Try other versions of flutter manually, using flutter version .
You can also run the program from Xcode, and try opening the emulator from there.
You can indeed use
flutter create .
to "repair" the current project to a limited degree.
If the ios/ or android/ folders are missing, they are created.
You can use this to switch native language Java/Kotlin, ObjC/Swift or to get the generated files updated to match newer Flutter versions by deleting the directories and running
flutter create . [options]
You need to re-apply previously made manual changes yourself though.

Flutter version on IOS stuck at 1.0.0

When I run:
pod outdated
on IOS to determine any pods that are outdated I get the following result:
....
Analyzing dependencies
The color indicates what happens when you run `pod update`
<green> - Will be updated to the newest version
<blue> - Will be updated, but not to the newest version because of specified version in Podfile
<red> - Will not be updated because of specified version in Podfile
The following pod updates are available:
- Flutter 1.0.0 -> 1.0.0 (latest version 1.3.300)
- Protobuf 3.9.2 -> 3.9.2 (latest version 3.10.0-rc1)
While version 1.0.0 of Flutter (in red) seems to be okay at the moment on IOS can someone please suggest how I can update this Pod?
I have upgraded Flutter using:
/Users/bob/Downloads/flutter/bin/flutter upgrade
The above command seems to make no difference per the pod version noted above. I would prefer everything be at the latest version but if it is not necessary knowing that information would be helpful as well.
Using:
/Users/bob/Downloads/flutter/bin/flutter doctor -v
reveals:
[✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14.6 18G95, locale en-US)
• Flutter version 1.9.1+hotfix.2 at /Users/bob/Downloads/flutter
• Framework revision 2d2a1ffec9 (3 weeks ago), 2019-09-06 18:39:49 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/bob/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
• CocoaPods version 1.6.0
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (1 available)
• iPhone 11 Pro Max • 08EB7508-34DE-4797-8F33-3DEE671742E4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
• No issues found!
The problem comes from the podhelper.rb script (YOUR_PATH//flutter/packages/flutter_tools/bin/podhelper.rb). It generates a 'fake' Flutter.podspec file but it hardcodes the 1.0.0 podspec.
Resolve this by editing lines 155-190 of podspec.rb (for iOS app), replacing the json definitions for the podspec with the version you want to move to from the CocoaPods repo (e.g. here for v2.5). Run pod update and it will update to 2.5.
The next section in the script repeats the same error for macOS apps so you may need to repeat for lines 193-228.
I am testing this right now but if you navigate into app_project/ios/Flutter/Flutter.podspec you will see there is Flutter version hardcoded to 1.0.0
Now I am no expert in Flutter so I don't know if you are supposed to manually change this, to what version you should change it, if it even makes any difference and why flutter don't provide script when you perform flutter upgrade to also update this file and flutter version.
Update your podhelper.rb on this path to update Flutter version on iOS.
YOUR_PATH//flutter/packages/flutter_tools/bin/podhelper.rb
s.name = 'Flutter'
s.version = '3.0.0'
Flutter 1.0.0 -> 1.0.0 (latest version 3.0.0)

Flutter fresh installation flutter run stuck

I am new to flutter i have fresh installtion.
All as in docs.
As after fresh installation i was fine worked but when i want to work on another day flutter run i stuck.... I do not know why. I only make boilerplate app. I xcode when i build app is opening in simulator but stating as flutter run not working. I even try to wait 20 min with this flutter run but still stuck
flutter doctor -v
[✓] Flutter (Channel master, v1.6.4-pre.14, on Mac OS X 10.14.5 18F132, locale
pl-PL)
• Flutter version 1.6.4-pre.14 at /Users/db/Desktop/Mobile/flutter
• Framework revision 81c38b22cb (32 hours ago), 2019-05-24 22:51:02 -0400
• Engine revision 8dc3a4cde2
• Dart version 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/db/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• CocoaPods version 1.7.0
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 35.3.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
[✓] Connected device (1 available)
• iPhone 8 • F35EFD3E-C637-427A-8405-30EDF202939A • ios •
com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)
• No issues found!
flutter run -v stuck at this stage.
+file:///Users/db/Desktop/Mobile/flutter/packages/flutter/lib/widgets.d
art
[ ] -> +file:///Users/db/Desktop/Flutter/iamsmart/lib/main.dart
[ ] -> 35191e22-84d6-4fab-abef-178ae9e4c665 build/app.dill 0
[ +319 ms] Building bundle
[ ] Writing asset files to build/flutter_assets
[ +55 ms] Wrote build/flutter_assets
[ +12 ms] Using legacy Xcode build system.
[ +27 ms] executing: [/Users/db/Desktop/Flutter/iamsmart/ios/]
/usr/bin/xcodebuild -list
Run this command
flutter clean
And then again
flutter run
Try to upgrade your flutter version to v 1.7.8 by running this
command this needs internet connection
flutter upgrade
Try this command
flutter clean
Change your flutter channel to stable
flutter channel stable
Check your internet connection because sometimes it prevents me from
running my app
Try to switch your flutter channel master to stable channel. After switching the channels you should call flutter upgrade to download the Flutter SDK and dependent packages.
Do this steps in the terminal
flutter channel stable
flutter upgrade
try to run your code after this steps.
Update to 1.9.1-hotfix4 fixed the problem
Your flutter doctor isn't showing any error as you had shared the commands.I think to share the run command terminal so that we can find out the stack of flowing of commands.
If you are getting error to build flutter project then you should update the Android Studio or VS Code Editor.
You can refer here:
Android studio-https://developer.android.com/studio
VS Code-https://code.visualstudio.com/Download
If you are able to create flutter project but doesn't getting run command then you need to update flutter and dart.
You can refer here:
Flutter-https://flutter.dev/docs/development/tools/sdk/releases
Dart-https://dart.dev/get-dart
If still you are suffering from error then you need to share some more Pics.
Probably something's gone wrong after you changed some files in of flutter ide. Also it does after updates crashed.
So the thing you should do is firstly backup your projects if it indeed. After backup remove the ide and be sure uninstalling complate succesful. Restart your computer and install all decencies again. Because sometimes upgrading does not works well to get good result.
P.S : Dont forget using flutter doctor for checking if any problem comes out.

Android SDK is missing command line tools

I've installed flutter but when I run flutter doctor to verify the installation, I get:-
Android SDK is missing command line tools
I've doubled checked that the command lines are installed.
What do I need to do remove this error?
I've included the full flutter doctor -v output below:-
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.3.1, on Mac OS X 10.13.4 17E202, locale en-AU)
• Flutter version 0.3.1 at /Users/chris/flutter
• Framework revision 12bbaba9ae (2 weeks ago), 2018-04-19 23:36:15 -0700
• Engine revision 09d05a3891
• Dart version 2.0.0-dev.48.0.flutter-fe606f890b
[!] Android toolchain - develop for Android devices
• Android SDK at /usr/local/Caskroom/android-platform-tools/27.0.1
• Android NDK location not configured (optional; useful for native profiling support)
• ANDROID_HOME = /usr/local/Caskroom/android-sdk/3859397
✗ Android SDK is missing command line tools;
• Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 24.1.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 24.1.2
• Dart plugin version 181.4668.60
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
On Android Studio open SDK Manager.
Go to SDK Tools tab.
Check if Android SDK Command-line Tools is checked. If not, check and apply the changes.
For some reason, after updating flutter and Android Studio, I got this error too. Seems like some new requirement that for some reason wasn't automatically installed.
This fixed it for me.
I think ANDROID_HOME and ANDROID SDK should be pointing to the same path and that is the SDK's root directory.
In my .bashrc (on LINUX), following are
export ANDROID_HOME=/home/myname/Android/Sdk
export PATH=/home/myname/Android/Sdk:$PATH
export PATH=/home/myname/Android/Sdk/platform-tools:$PATH
export PATH=/home/myname/Android/Sdk/tools:$PATH
export PATH=/home/myname/Android/ndk-build:$PATH
Just solved the problem. Here are my system settings:
System variable ANDROID_SDK_ROOT points to my Android SDK dir
In system Path variable, I have sdk/tools, sdk/platform-tools, and /flutter-dir/bin
Also make sure you don't have dulplicated directories. I previously downloaded another platform-tools and add it to Path, so I had to delete it and use the sdk's one.
After changing those things, I close the flutter cmd windows and run flutter doctor on PowerShell. Worked like a charm!
Please download the latest sdk build-tools to solve the problem of Android SDK is missing command line tools