Signing and aligning APK file(s) **/*.apk in Azure Devops

Viewed 1537

I have been trying to make devops build of android apk and my pipeline fails in Signing and aligning Apk Stage.

I am getting the following error

##[error]Error: No matching files were found with search pattern: D:\a\1\s***.apk PIPELINE Definition Snapshot_1] PIPELINE Definition Snapshot_2

2 Answers

[error]Error: No matching files were found with search pattern: D:\a\1\s***.apk

This error indicates that you don't have a xx.apk file generated in default working directory. You can follow steps below to locate the root cause of the issue and resolve that:

  1. Leave gradlew build task's working directory blank and make sure this task succeeds to generate the xx.apk file.

  2. In Android signing task, use the **\*.apk pattern.

  3. Make sure the gradlew build and Signing and aligning APK tasks are in same Job. If you're using hosted agent to run those tasks, they must be in same job within same pipeline/stage so that the Signing and aligning APK task can directly access the outputs of gradlew build task.

    Please make sure these two tasks are in same job. If you have specific reason that you have to make them in separate jobs/stages/pipelines, consider using Artifacts-related tasks to share the files between jobs/stages/pipelines.

    Since a job is a series of steps that run sequentially as a unit, different jobs will run in different machines though those agents are called hosted windows/linux. So it's recommended to put the two tasks in same job.

  4. If the tasks are in same job while the issue persists, set the system.debug variable to true and run the pipeline again, then you can check the details about the gradlew build task.

    enter image description here

    Then you can find the output path where the xx.apk files are generated. After that copy those files to Default working directory ($(System.DefaultWorkingDirectory)) and the signing task can find the file.

It looks like .apk file is not found under working directory of the build agent. Please check code checkout step of the build pipeline and make sure the .apk file is being checked out as part of the build step. You can view the log as well to confirm this.

Related