Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Gradle内置Visual Studio Team Services sdk许可证错误_Android_Azure Pipelines - Fatal编程技术网

Android Gradle内置Visual Studio Team Services sdk许可证错误

Android Gradle内置Visual Studio Team Services sdk许可证错误,android,azure-pipelines,Android,Azure Pipelines,我试图在Visual Studio Team Services中创建一个正常工作的android gradle构建定义,但我总是遇到以下错误: 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

我试图在Visual Studio Team Services中创建一个正常工作的android gradle构建定义,但我总是遇到以下错误:

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
我搜索了一下,但没有找到任何有用的东西,有人能帮我吗


提前感谢

定义了修复此错误的方法。下面是如何在VisualStudioTeamServices中修复它。步骤是

  • 创建“%ANDROID\u HOME%\licenses”目录
  • 创建“%ANDROID\u HOME%\licenses\ANDROID sdk license”文件
  • 输出所创建文件的内容以进行验证
  • 详情如下:

  • 创建“命令行”类型的新“构建步骤”,该步骤属于“实用程序”类别

    • 工具=
      mkdir
    • 参数=
      %ANDROID\u HOME%\licenses“
  • 创建另一个“命令行”构建步骤

    • 工具=
      echo
    • 参数=
      | set/p=“8933bad161af4178b1185d1a37fbf41ea5269c55”>%ANDROID\u HOME%\licenses\ANDROID sdk license”
    • 选中“出错时继续”,因为此echo命令将返回1
  • 为了验证,创建第三个“命令行”构建步骤
    • 工具=
      更多信息
    • 参数=
      %ANDROID\u HOME%\licenses\ANDROID sdk license“
  • 在执行“渐变”构建步骤之前,将这些构建步骤按1、2、3的顺序排列


    这是个好消息。坏消息是,gradle构建步骤在SDK安装过程中失败,错误为“无法移开或删除现有目标文件”。因此,如果您找到了这个问题,请告诉我。

    感谢Mike提供的解决方法!我遇到的一个问题是,由于步骤2中的错误,构建“部分成功”

    为了获得“成功”构建而不是“部分成功”构建,我将三个命令行步骤替换为一个powershell步骤,以执行内联脚本:

    New-Item -ItemType Directory -Path "C:\java\androidsdk\android-sdk\licenses"
    
    New-Item -Name 'android-sdk-license' -ItemType File -Value '8933bad161af4178b1185d1a37fbf41ea5269c55' -Path "C:\java\androidsdk\android-sdk\licenses"
    
    Get-Content "C:\java\androidsdk\android-sdk\licenses\android-sdk-license"