Unfortunately the way as OP originally solved it does not always work.
If you find from the error message what is your builds current build-tools version. It could be that it is a higher version of build-tools that is missing. In that case you need to manually start SDK Manager and add the build-tools and accept license.
Per OP instructions, it look as follows.
$ ./gradlew build
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 24.0.2].
...
BUILD FAILED
NOTE: 2017-04-16
The android
tool has now been deprecated in favor of the new sdkmanager
. Please see Joe Lawson's answer and subsequent posts from March (2017) and onward.
Then adjust you command as follows:
android update sdk --no-ui --filter build-tools-24.0.2,android-24,extra-android-m2repository
Refresh Sources:
Fetching https://dl.google.com/android/repository/addons_list-2.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Refresh Sources
Fetching URL: https://dl.google.com/android/repository/repository-11.xml
Validate XML: https://dl.google.com/android/repository/repository-11.xml
Parse XML: https://dl.google.com/android/repository/repository-11.xml
...
Error: Ignoring unknown package filter 'build-tools-24.0.2'
-------------------------------
License id: android-sdk-license-xxxxxxxx
Used by:
- SDK Platform Android 7.0, API 24, revision 2
- Android Support Repository, revision 39
-------------------------------
...
November 20, 2015
Do you accept the license 'android-sdk-license-xxxxxxxx' [y/n]: y
Installing Archives:
Preparing to install archives
Downloading SDK Platform Android 7.0, API 24, revision 2
Installing SDK Platform Android 7.0, API 24, revision 2
Installed SDK Platform Android 7.0, API 24, revision 296%)
Downloading Android Support Repository, revision 39
Installing Android Support Repository, revision 39
Installed Android Support Repository, revision 3999%)
Done. 2 packages installed.
Running this again, still do not make Gradle happy. So manual acceptance is the only solution until someone come up with something better. (Please do!)
echo y |
in front of that command to auto accept the licence. Useful when running on a headless CI box :) – Schulman~/.android/tools/android update sdk --no-ui --filter build-tools-25.0.0,android-25,extra-android-m2repository
because theandroid
tool was localized to my home – Symphonious$ANDROID_SDK_PATH
to the actual root path where you've installed the SDK (i.e.:/opt/android-sdk
), or just put the path directly (i.e.:yes | sdkmanager --licenses --sdk_root=/opt/android-sdk
) – Bootsyes | sudo sdkmanager --licenses
this throws anError: Unknown argument --licenses
@Retrochoir – ConstantinoRUN sh -c ' printf "y\ny\ny\ny\ny\ny\ny\ny\ny\ny\n" | ./sdkmanager --licenses
– Uponsudo
, only to realize that after accepting the licenses, they still showed as not accepted underuser
. To solve this, precede thesdkmanager --licenses
withsudo chmod a+w $ANDROID_HOME/licenses
– Cephalometer