Since gradle android plugins 2.2-alpha4:
Gradle will attempt to download missing SDK packages that a project depends on
Which
If you are using Flutter just run:
flutter doctor --android-licenses
And accept all the licenses needed.
You can accept all the license by executing the following command:
sdkmanager --licenses
This will prompt you through each licenses you haven't accepted yet and you can just enter y
to accept each of them.
As of July 2019, the easiest method is to use: flutter doctor --android-licenses
in the command prompt.
It proceeds to display the unaccepted T&C of SDKs one by one and you're given option to choose 'y/n'. Choose y for all.
Alternately, when you run flutter doctor
, it will run Android toolchain diagnostics which displays how many licenses are not yet accepted, and suggests you to run it with the --android-licenses flag.
for windows, open cmd and enter into bin
directory by running command:
cd C:\Users\username\AppData\Local\Android\sdk\tools\android\Sdk\tools\bin
then run sdkmanager --licenses
command, it asks to accept licenses.
For those having issues with the command line SDK, the reason it won't find the licenses you have accepted is because they have have been written to a different location than $ANDROID_HOME/licenses
which is where they need to be.
I found the easiest solution was to accept the licenses like this:
$ANDROID_HOME/bin/sdkmanager --licenses --sdk_root=$ANDROID_HOME
Note: This assumes you've set ANDROID_HOME
to point to wherever your sdk is installed.
If you are using Jenkins, you can use the following bash script as first step in the build process:
(while sleep 3; do echo "y"; done) | $ANDROID_HOME/tools/android update sdk -u
This will of course install ALL available updates, but it will save you some time if you can spare the disk space. The sleep is to avoid the broken readline in the installation program, since "yes" does not work properly in this case.
EDIT: You also need to add the "Install Android project prerequisites" plugin in the build step to get the correct $ANDROID_HOME if you are using the built in SDK manager.