Since gradle android plugins 2.2-alpha4:
Gradle will attempt to download missing SDK packages that a project depends on
Which
I finally found a solution on Windows, to have a real silent and automatic install:
On Windows, the following syntax doesn't work:
echo y | sdkmanager --licenses
It seems the "y" aren't correctly sent to the java program called in the batch.
The workaround is to create a file file-y.txt with several "y", one by line, and to use
call sdkmanager --licenses < file-y.txt
This will create the needed files in the licenses directory. The problem is probably related to the use of BufferedReader in Java