I'm trying to create a working android gradle build definition in Visual Studio Team Services but I always get this error:
2016-10-09T07:30:56.0626848Z FAILURE: Build failed with an exception.
2016-10-09T07:30:56.0626848Z
2016-10-09T07:30:56.0626848Z * What went wrong:
2016-10-09T07:30:56.0626848Z A problem occurred configuring project ':twuice_theme'.
2016-10-09T07:30:56.0636849Z > You have not accepted the license agreements of the following SDK components:
2016-10-09T07:30:56.0636849Z [Android SDK Platform 24, Android SDK Build-Tools 24.0.3].
2016-10-09T07:30:56.0636849Z 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.
2016-10-09T07:30:56.0636849Z 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
2016-10-09T07:30:56.0636849Z
2016-10-09T07:30:56.0636849Z * Try:
2016-10-09T07:30:56.0636849Z Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
2016-10-09T07:30:56.0636849Z
2016-10-09T07:30:56.0636849Z BUILD FAILED
2016-10-09T07:30:56.0636849Z
2016-10-09T07:30:56.0636849Z Total time: 55.145 secs
2016-10-09T07:30:56.4528586Z [Error: C:\a\1\s\gradlew.bat failed with return code: 1]
2016-10-09T07:30:56.4718591Z ##[error]Error: C:\a\1\s\gradlew.bat failed with return code: 1
2016-10-09T07:30:56.4788582Z ##[section]Finishing: gradlew build
I searched but didn't find anything useful, so could somebody help me?
Thanks in advance
Thanks Mike for providing a workaround! The one issue that I ran into was that the builds were "partially successful" because of the error in step 2.
To get "successful" builds instead of "partially successful" builds, I replaced the three command line steps with one powershell step to execute an inline script:
The method of fixing this error is defined here. Here is how you fix it within Visual Studio Team Services. The steps are
Here's the details:
Create a new "Build step" of type "Command Line" which is in the "Utilities" category.
mkdir
"%ANDROID_HOME%\licenses"
Create another "Command Line" build step.
echo
|set /p="8933bad161af4178b1185d1a37fbf41ea5269c55" > "%ANDROID_HOME%\licenses\android-sdk-license"
more
"%ANDROID_HOME%\licenses\android-sdk-license"
Place these build steps in 1,2,3 order prior to executing your "Gradle" build step.
That's the good news. The bad news is that the gradle build step is failing during SDK installation with the error "Failed to move away or delete existing target file." So let me know if you figure that one out.