failed to install the following android sdk packages as some licences have not been accepted. ubuntu code example

Example 1: Failed to install the following Android SDK packages as some licences have not been accepted.

# macos:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses

# windows:
%ANDROID_HOME%/tools/bin/sdkmanager --licenses

# GNU/Linux Distributions:
yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses

Example 2: Failed to install the following Android SDK packages as some licences have not been accepted.

> flutter doctor --android-licenses

Example 3: To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.

# Android SDK Tools 25.2.3 and lower. Install the latest `platform-tools` for android-25
android update sdk --no-ui --all --filter platform-tools,android-25,extra-android-m2repository

# Android SDK Tools 25.2.3 and higher
sdkmanager --update