Reputation: 11
I have an Issue when trying to release my Android app to Play store sing Azure pipeline. Below is my yml file,im using Maui .NET8 Thank you.
NB: I have another pipeline that also sign in the other app to same Play store
`- stage: BuildAndroid displayName: Build Android jobs:
job: BuildAndroidJob pool: vmImage: 'windows-2022'
steps:
task: CmdLine@2 inputs: script: 'dotnet workload install maui'
task: UseDotNet@2 displayName: 'Install .NET sdk' inputs: packageType: sdk version: 8.0.x installationPath: $(Agent.ToolsDirectory)/dotnet
task: JavaToolInstaller@0 displayName: Configure Java version inputs: versionSpec: '11' jdkArchitectureOption: 'x64' jdkSourceOption: 'PreInstalled'
task: android-manifest-version@1 displayName: Version Android build inputs: sourcePath: 'path/to/AndroidManifest.xml' versionCodeOption: 'buildid' versionCode: '$(Build.BuildId)' versionName: '$(buildVersionPrefix).$(Build.BuildId)' versionCodeOffset: '10000' printFile: true
task: NuGetToolInstaller@1 displayName: Install nuget tool
task: DotNetCoreCLI@2 inputs: command: 'build' projects: '**/*.sln' arguments: '-c Release -f net8.0-android'
task: AndroidSigning@2 displayName: 'Sign .aab' inputs: apkFiles: '**/*.aab' jarsign: true jarsignerKeystoreFile: '$(KeyStoreSecureFileName)' jarsignerKeystorePassword: '$(KeystorePassword)' jarsignerKeystoreAlias: '$(Alias)' jarsignerKeyPassword: '$(AliasPassword)' jarsignerArguments: '-sigalg SHA256withRSA -digestalg SHA-256' zipalign: true
task: CopyFiles@2 displayName: Copy .apk to staging directory inputs: Contents: '**/*.apk' TargetFolder: '$(Build.ArtifactStagingDirectory)' OverWrite: true flattenFolders: true
task: CopyFiles@2 displayName: Copy .aab to staging directory inputs: Contents: '**/*.aab' TargetFolder: '$(Build.ArtifactStagingDirectory)' OverWrite: true flattenFolders: true
task: PublishBuildArtifacts@1 displayName: Publish .apk and .aab inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' ArtifactName: 'drop' publishLocation: 'Container'`
I have tried removing the signing in task but still I get an issue.
Upvotes: 1
Views: 364
Reputation: 8195
Instead of using AndroidSigning@2 task, Use
GooglePlayRelease@4
with the GooglePlayConnectionService and run the pipeline.
Refer the blog here for the details steps.
Install the Official Google play extension
in your Azure DevOps account from here:-
After the extension is installed Create a Private key and add an Google Play Azure service connection in Azure DevOps with the same Private key and Google play developer account.
My Azure DevOps yaml pipeline:-
jobs:
- job:
displayName: 'Build and Publish to Google Play Store'
pool:
vmImage: 'windows-latest'
steps:
- task: CmdLine@2
inputs:
script: 'dotnet workload install maui'
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: sdk
version: 8.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: JavaToolInstaller@0
displayName: 'Configure Java version'
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- task: android-manifest-version@1
displayName: 'Version Android build'
inputs:
sourcePath: 'path/to/AndroidManifest.xml'
versionCodeOption: 'buildid'
versionCode: '$(Build.BuildId)'
versionName: '$(buildVersionPrefix).$(Build.BuildId)'
versionCodeOffset: '10000'
printFile: true
- task: NuGetToolInstaller@1
displayName: 'Install NuGet tool'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '**/*.sln'
arguments: '-c Release -f net8.0-android'
- task: CopyFiles@2
displayName: 'Copy AAB to artifacts directory'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/YourMauiProject/bin/Release/net8.0-android/'
Contents: '*.aab'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- task: GooglePlayRelease@4
displayName: 'Publish to Google Play Store'
inputs:
serviceConnection: 'GooglePlayConnectionService'
applicationId: 'com.yourcompany.yourapp'
action: 'SingleBundle'
bundleFile: '$(Build.ArtifactStagingDirectory)/**/*.aab' # Adjust the path accordingly
track: 'internal'
The Pipeline worked without GooglePlayRelease@4 task too.
Reference Github issue
Upvotes: 1