I've created an Azure DevOps pipeline script for my Android project. The build is successful, but when I try to upload artifacts, it fails with the message "no artifacts found."
My azure-pipelines.yml is as follows:
trigger:
- main
pool:
vmImage: 'windows-latest'
stages:
- stage: Build
displayName: 'Build APK'
jobs:
- job: BuildDebug
displayName: 'Build Debug APK'
steps:
- task: JavaToolInstaller@0
inputs:
versionSpec: '17'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- script: |
echo "Checking Java version"
java -version
displayName: 'Check Java Version'
- script: |
echo "Running Gradle task: assembleDebug"
java -version
./gradlew clean
./gradlew assembleDebug
displayName: 'Run Gradle Build'
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: app\build\outputs\apk
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\app\build\outputs\apk\debug'
ArtifactName: 'apk'
publishLocation: 'Container'
Error:
##[error]Error: Not found SourceFolder: D:\a\1\s\app\build\outputs\apk
I've tried adding the tree command to check the build folder, but it isn't created.
I've tried adding tree
command to see if build folder is being created after gradle build
, but it isnt.
- script: |
echo "Tree"
tree
tree $(Build.ArtifactStagingDirectory)
displayName: 'Tree'
CopyFiles@2
task? Try adding a task to list files inapp\build\outputs\apk
folder, before publishing the artifacts.Run Gradle Build
.tree /a /f $(Build.SourcesDirectory)
command to check the files before and after the build task. This command will display the names of the files in each directory.