C:\Users\USER>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19042.928], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Android Studio
[√] VS Code (version 1.56.1)
[√] Connected device (2 available)
! Doctor found issues in 1 category.
C:\Users\USER>flutter doctor --android-licenses
Error: Could not find or load main class J\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\\..
Caused by: java.lang.ClassNotFoundException: J\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\\//
EDIT 1:
I tried reinstalling sdk (after deleting files completely from appdata/android/sdk). it kinda worked but now new error is showing.:
C:\Users\USER>flutter doctor --android-licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
After a lot of searching and a lot of diff types of error ranging from environmental variable errors and java errors, i just uninstalled android studio, java and flutter files deleted appdatas etc. and reinstalled it again now flutter doctors works fine.
i know this is not a good solution but someone could try this if all else fails. thks