0
votes

I am trying to setup build pipeline in azure devops for my android application. I am trying to trigger build with a basic auto generated yml file. The pipeline remains stuck at "agent connecting" for a while and then build fails with error "##[error]Error: The process '/Users/vsts/agent/2.158.0/work/1/s/gradlew' failed with exit code 1".

My yml file contents are

- master
pool:
  vmImage: 'macos-latest'
steps:
- task: Gradle@2
  inputs:
    workingDirectory: ''
    gradleWrapperFile: 'gradlew'
    gradleOptions: '-Xmx3072m'
    publishJUnitResults: false
    testResultsFiles: '**/TEST-*.xml'
    tasks: 'assembleDebug'
1
Could you please set the variable system.debug=true and then queue the build again? Then share the log here, especially the log with the error. In addition, is this your whole yml file content? It seems like some wrong.Frank Wang-MSFT
Hi, I updated the yml file it failed again. Here is the yml file: trigger: - master pool: vmImage: 'ubuntu-16.04' steps: - task: Gradle@2 inputs: workingDirectory: '' gradleWrapperFile: 'gradlew' gradleOptions: '-Xmx3072m' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false testResultsFiles: '**/TEST-*.xml' tasks: 'assembleDebug'Kumar Gaurav
* What went wrong: A problem occurred configuring project ':app'. > Failed to install the following SDK components: build-tools;29.0.1 Android SDK Build-Tools 29.0.1 The SDK directory is not writable (/usr/local/lib/android/sdk)Kumar Gaurav
@Kumar Gaurav If the build tools failed to be installed by azure pipeline. You can try installed it manually to your self-hosted agent. If you are running on cloud-hosted agents. You can refer to this closed issue to open a new issue requesting adding this tool to macos agentsLevi Lu-MSFT
Gradle task value must be :app:bundleRelease to generate .aab file. see below example: - task: Gradle@2 inputs: gradleWrapperFile: 'gradlew' tasks: ':app:bundleRelease' publishJUnitResults: false javaHomeOption: 'JDKVersion' sonarQubeRunAnalysis: false spotBugsAnalysis: falseH_H

1 Answers

0
votes

@Kumar Gaurav If this is still an issue you can switch from yml to the classic editor. On Android there is a new .aab file format which is smaller in size compared to .apk build format. Here is how I would do it.

  • I would first setup a jks file via the Download secure file task
  • Create an unsigned build via the gradle task
  • Sign the build and Generate .aab file by executing jar signer command via the command prompt task
  • Create an Artifact via the Copy Files and Publish the build artifacts tasks

You can also use the release pipeline to deploy your aab files to deploy to the Play Store directly.

For more information you can visit this link. It includes a very comprehensive way on how to setup the CI-CD pipelines for Android on Azure Devops