Not accepted the license SDK Platform 24

This problem on Android is driving me nuts. I’ve been trying to come out with a solution for almost an entire day and I still have the same problem. None of the answers related to the same problem have worked on my builds.

my YAML is:

`
general:
artifacts:
- /home/ubuntu/AndroidCI/app/build/outputs/apk/

machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
GRADLE_OPTS: -Xmx512m -XX:MaxPermSize=512m
java:
version: oraclejdk8

dependencies:
cache_directories:
- ~/.android
- ~/android
override:
- (source scripts/environmentSetup.sh && getAndroidSDK)
`

and the script something like:

`function getAndroidSDK(){
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"

DEPS="$ANDROID_HOME/installed-dependencies"

if [ ! -e $DEPS ]; then
echo y | android update sdk --no-ui --all --filter tools &&
echo y | android update sdk --no-ui --all --filter platform-tools &&
echo y | android update sdk --no-ui --all --filter build-tools-24.0.3 &&
echo y | android update sdk --no-ui --all --filter build-tools-25.0.3 &&
echo y | android update sdk --no-ui --all --filter build-tools-25.0.2 &&
echo y | android update sdk --no-ui --all --filter build-tools-25.0.1 &&
echo y | android update sdk --no-ui --all --filter android-24 &&
echo y | android update sdk --no-ui --all --filter android-25 &&
echo y | android update sdk --no-ui --all --filter extra-android-m2repository &&
echo y | android update sdk --no-ui --all --filter extra-android-support &&
echo y | android update sdk --no-ui --all --filter extra-google-m2repository &&
touch $DEPS
fi
}`

I’ve tried more than 20 combinations and nothing, I still get the same problem:

3 projects18:32:18.027 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception. 18:32:18.030 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 18:32:18.031 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 18:32:18.031 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred configuring project ':app'. 18:32:18.031 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > You have not accepted the license agreements of the following SDK components: 18:32:18.032 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] [Android SDK Platform 24]. 18:32:18.034 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. 18:32:18.047 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html 18:32:18.048 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]

But as you can see I am already accepting the agreement in the script.

and more details about the problem:

[org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is: 18:32:18.053 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'. 18:32:18.053 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79) 18:32:18.054 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74) 18:32:18.054 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61) 18:32:18.054 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:573) 18:32:18.055 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:125) 18:32:18.055 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47) 18:32:18.055 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38) 18:32:18.056 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:151) 18:32:18.060 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22) 18:32:18.061 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 18:32:18.061 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53) 18:32:18.061 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:148) 18:32:18.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33) 18:32:18.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112) 18:32:18.062 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:106) 18:32:18.063 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 18:32:18.063 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63) 18:32:18.064 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106) 18:32:18.064 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:92) 18:32:18.065 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66) 18:32:18.065 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) 18:32:18.065 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 18:32:18.066 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) 18:32:18.066 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) 18:32:18.066 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:79) 18:32:18.067 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:51) 18:32:18.067 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59) 18:32:18.067 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 18:32:18.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47) 18:32:18.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) 18:32:18.071 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.071 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) 18:32:18.071 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.072 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) 18:32:18.072 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) 18:32:18.072 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.util.Swapper.swap(Swapper.java:38) 18:32:18.073 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) 18:32:18.073 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.073 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) 18:32:18.074 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) 18:32:18.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 18:32:18.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.078 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) 18:32:18.078 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 18:32:18.078 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.078 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44) 18:32:18.079 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 18:32:18.079 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) 18:32:18.079 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293) 18:32:18.080 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) 18:32:18.080 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) 18:32:18.080 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.lang.RuntimeException: You have not accepted the license agreements of the following SDK components: 18:32:18.081 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] [Android SDK Platform 24]. 18:32:18.081 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. 18:32:18.091 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html 18:32:18.091 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.builder.sdk.DefaultSdkLoader.checkResults(DefaultSdkLoader.java:516) 18:32:18.092 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.builder.sdk.DefaultSdkLoader.getTargetInfo(DefaultSdkLoader.java:148) 18:32:18.092 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.build.gradle.internal.SdkHandler.initTarget(SdkHandler.java:146) 18:32:18.092 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.build.gradle.BasePlugin.ensureTargetSetup(BasePlugin.java:760) 18:32:18.093 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:657) 18:32:18.093 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:608) 18:32:18.093 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:605) 18:32:18.093 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156) 18:32:18.094 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120) 18:32:18.094 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.build.gradle.BasePlugin.lambda$createTasks$1(BasePlugin.java:603) 18:32:18.094 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93) 18:32:18.095 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82) 18:32:18.095 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44) 18:32:18.095 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79) 18:32:18.096 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30) 18:32:18.097 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) 18:32:18.097 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.sun.proxy.$Proxy14.afterEvaluate(Unknown Source) 18:32:18.097 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67) 18:32:18.098 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] ... 52 more 18:32:18.098 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 18:32:18.098 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] 18:32:18.099 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED 18:32:18.099 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] 18:32:18.099 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] Total time: 19.019 secs

It seems like Android may have changed the license hash again. Since you have if [ ! -e $DEPS ]; then it’s not going to download again.

Have you tried a rebuild without cache yet?