代码之家  ›  专栏  ›  技术社区  ›  Lorenzo Battilocchi

如何建立基于Visual Studio团队服务的Android构建

  •  2
  • Lorenzo Battilocchi  · 技术社区  · 6 年前

    我对VSTS和整个Microsoft在线服务平台还比较陌生。

    我在尝试初始化我们的VSTS存储库上的构建时遇到一个问题。我从下拉菜单中选择了默认的Android构建设置,但它不起作用。每次我尝试建造时,我都会到达 gradlew build 阶段和我得到错误: Error: D:\a\1\s\gradlew.bat failed with return code: 1

    我可以使用android studio ide构建代码,但现在我需要使用vsts。 ` 任何帮助都将不胜感激。谢谢您!

    编辑:这是生成的完整日志

    2018-07-28T19:23:31.6824618Z ##[section]Starting: gradlew build
    2018-07-28T19:23:31.6830050Z ==============================================================================
    2018-07-28T19:23:31.6830213Z Task         : Gradle
    2018-07-28T19:23:31.6830359Z Description  : Build using a Gradle wrapper script
    2018-07-28T19:23:31.6830487Z Version      : 2.137.1
    2018-07-28T19:23:31.6830608Z Author       : Microsoft Corporation
    2018-07-28T19:23:31.6830766Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613720)
    2018-07-28T19:23:31.6830930Z ==============================================================================
    2018-07-28T19:23:33.2899535Z SonarQube analysis is enabled.
    2018-07-28T19:23:33.2900156Z Checkstyle analysis is enabled.
    2018-07-28T19:23:33.2900406Z FindBugs analysis is enabled.
    2018-07-28T19:23:33.2900654Z PMD analysis is enabled.
    2018-07-28T19:23:33.2900905Z SYSTEMVSSCONNECTION exists true
    2018-07-28T19:23:33.2901941Z [command]C:\Windows\system32\cmd.exe /D /S /C "D:\a\1\s\gradlew.bat build sonarqube -I D:\a\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.137.1\node_modules\codeanalysis-common\checkstyle.gradle -I D:\a\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.137.1\node_modules\codeanalysis-common\findbugs.gradle -I D:\a\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.137.1\node_modules\codeanalysis-common\pmd.gradle"
    2018-07-28T19:24:05.3436260Z Downloading https://services.gradle.org/distributions/gradle-4.6-all.zip
    2018-07-28T19:24:29.2233239Z Unzipping C:\Users\VssAdministrator\.gradle\wrapper\dists\gradle-4.6-all\bcst21l2brirad8k2ben1letg\gradle-4.6-all.zip to C:\Users\VssAdministrator\.gradle\wrapper\dists\gradle-4.6-all\bcst21l2brirad8k2ben1letg
    2018-07-28T19:25:41.8632779Z Starting a Gradle Daemon (subsequent builds will be faster)
    

    我们使用的软件包的一系列下载,为了字符限制省略了

    2018-07-28T19:26:20.6092629Z Applying the Checkstyle plugin to project s
    2018-07-28T19:26:20.6792218Z Applying the FindBugs plugin to project s
    2018-07-28T19:26:20.6792841Z Applying the PMD plugin to all projects
    2018-07-28T19:26:23.9485033Z Applying the Checkstyle plugin to project volve
    2018-07-28T19:26:23.9621010Z Applying the FindBugs plugin to project volve
    2018-07-28T19:26:23.9621425Z Applying the PMD plugin to all projects
    2018-07-28T19:26:28.6406403Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6407012Z support library package not found: android.support.constraint.motion.
    2018-07-28T19:26:28.6407656Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6407994Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6408285Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6408525Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6408784Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6409785Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6410031Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6410325Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6410567Z support library package not found: android.support.constraint.
    2018-07-28T19:26:28.6410830Z support library package not found: android.support.constraint.
    2018-07-28T19:26:39.5509667Z Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
    2018-07-28T19:26:39.6403284Z registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    2018-07-28T19:26:39.7610924Z registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    2018-07-28T19:26:39.7830309Z Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
    2018-07-28T19:26:39.7922748Z registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    2018-07-28T19:26:39.8933520Z registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    2018-07-28T19:26:39.9253837Z 
    2018-07-28T19:26:39.9254479Z FAILURE: Build failed with an exception.
    2018-07-28T19:26:39.9254716Z 
    2018-07-28T19:26:39.9254905Z * What went wrong:
    2018-07-28T19:26:39.9255123Z Task 'sonarqube' not found in root project 's'.
    2018-07-28T19:26:39.9255269Z 
    2018-07-28T19:26:39.9255429Z * Try:
    2018-07-28T19:26:39.9255675Z Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    2018-07-28T19:26:39.9255897Z 
    2018-07-28T19:26:39.9256078Z * Get more help at https://help.gradle.org
    2018-07-28T19:26:39.9256222Z 
    2018-07-28T19:26:39.9256413Z BUILD FAILED in 2m 49s
    2018-07-28T19:26:40.5195018Z Error: D:\a\1\s\gradlew.bat failed with return code: 1
    2018-07-28T19:26:40.5195970Z     at ChildProcess.<anonymous> (D:\a\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.137.1\node_modules\vsts-task-lib\toolrunner.js:569:30)
    2018-07-28T19:26:40.5196934Z     at emitTwo (events.js:106:13)
    2018-07-28T19:26:40.5197445Z     at ChildProcess.emit (events.js:191:7)
    2018-07-28T19:26:40.5198292Z     at maybeClose (internal/child_process.js:886:16)
    2018-07-28T19:26:40.5198771Z     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
    2018-07-28T19:26:40.6483964Z ##[warning]No test result files matching D:\a\1\s\**\TEST-*.xml were found, so publishing JUnit test results is being skipped.
    2018-07-28T19:26:40.6494902Z ##[error]Error: D:\a\1\s\gradlew.bat failed with return code: 1
    2018-07-28T19:26:40.6541754Z ##[section]Finishing: gradlew build
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   Marina Liu    6 年前

    您可以使用Android构建模板在VSTS中构建您的Android项目。

    渐变任务的详细配置如下:

    • Gradle Wrapper:relative path to Gradlew file
    • 工作目录:相同的目录,其中存在 gradlew file。它使用 $(build.sourcesdirectory). directory by default.
    • 任务:生成
    • < >

      例如,如果文件结构为 intro_android_demo ( gradlew file in the root directory of the repo),则gradle任务配置应如下所示:

      enter image description here

      的详细配置 Gradle任务 如下:

      • 渐变包装:相对路径 gradlew 文件
      • 工作目录:相同的目录,其中 格拉德洛 文件存在。它使用 $(Build.SourcesDirectory) 默认目录。
      • 任务:构建

      例如,如果文件结构为 intro_android_demo ( 格拉德洛 文件在repo的根目录中),则渐变任务配置应如下所示:

      enter image description here