我正试图在Azure Devops中为我的Xamarin应用程序构建一个Android管道。到目前为止,这就是我所拥有的:
# Xamarin.Android
# Build a Xamarin.Android project.
# Add steps that test, sign, and distribute an app, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/xamarin
trigger:
- master
pool:
vmImage: 'macos-latest'
# Installing NuGet
steps:
- task: NuGetToolInstaller@1
# Restoring the solutions
- task: NuGetCommand@2
inputs:
restoreSolution: '**/*.sln'
- task: NuGetCommand@2
inputs:
restoreSolution: 'Student360Mobile.Droid/Student360Mobile.Droid.csproj'
# Building the android app
- task: XamarinAndroid@1
inputs:
projectFile: 'Student360Mobile.Droid/Student360Mobile.Droid.csproj'
configuration: 'Release'
createAppPackage: true
# Signing the APK
- task: AndroidSigning@3
inputs:
apkFiles: '**/*.apk'
apksign: true
apksignerKeystoreFile: 'debug.keystore'
apksignerKeystorePassword: $(keystore.password)
apksignerKeystoreAlias: $(keystore.key.alias)
apksignerKeyPassword: $(keystore.key.password)
apksignerArguments: --out $(build.artifactStagingDirectory)/app.release.apk
zipalign: true
# Publishing the APK so we can distribute
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
# Distributing the APK to app store
- task: AppCenterDistribute@3
inputs:
serverEndpoint: 'App Center'
appSlug: 'Tyler-SIS-Mobile/Student360MobileAndroid'
appFile: '$(Build.ArtifactStagingDirectory)/app.release.apk'
releaseNotesOption: 'input'
releaseNotesInput: 'Automated build from App Center'
destinationType: 'groups'由于某些原因,我总是收到这样的错误:“没有找到匹配的文件和搜索模式。”我试过很多东西:
将XamarinAndroid@1任务的输出目录设置为特定目录,将appFile设置为该目录,然后将输出目录设置为$(build.artifactStagingDirectory),将appFile设置为$(build.artifactStagingDirectory)/*.apk
。
所有这些都不起作用。几乎没有任何APK被生成。我相信我已经对构建进行了适当的配置,但是我没有在日志中看到APK是在哪里生成的。当然,我也不知道是否会有一个日志。怎么回事?
发布于 2021-06-18 18:51:12
csproj文件被设置为创建AAB文件,而不是APK文件。我专门为Azure管道重写了这种行为,将arg,-p:AndroidPackageFormat=apk添加到Xamarin构建命令中。
https://stackoverflow.com/questions/68039104
复制相似问题