flutter doctor --android-licenses exception main code example
Example: flutter doctor --android-licenses java error
Installing Android SDK Command-line tools from Android SDK Manager did the job for me.
Open Tools > SDK Manager
From the left choose, Appearance & Behavior > System Settings > Android SDK
Select SDK Tools from the top menu
Check Android SDK Command-line tools and click 'apply'.