admin管理员组文章数量:1356852
My auto-generated versionCode is actually 2343, not 1.
Im trying to release an android app via Azure Pipelines, but their GooglePlayRelease@4 task keeps throwing an error, saying I have already used version code 1. Thi is despite the fact that I dont set a static versioncode, but derive it from number of git commits:
def getVersionCode = { ->
"git rev-list --count HEAD"
.execute()
.text.trim()
.toInteger()
}
defaultConfig {
applicationId 'com.my_app.app'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode getVersionCode() // here, should be 2343
versionName getVersionName()
}
Here's the task. I believe the problem could be during the signing task:
- task: AndroidSigning@3
inputs:
apkFiles: '$(Agent.BuildDirectory)/s/android/app/build/outputs/bundle/productionRelease/app-production-release.aab'
apksignerArguments: "--min-sdk-version 23"
apksignerKeystoreFile: 'my-app.keystore'
apksignerKeystorePassword: $(storePassword)
apksignerKeystoreAlias: $(keyAlias)
apksignerKeyPassword: $(keyPassword)
- task: GooglePlayRelease@4
inputs:
serviceConnection: 'Google Play Store Connection'
applicationId: 'com.my_app.app'
action: 'SingleBundle'
bundleFile: '$(Agent.BuildDirectory)/s/android/app/build/outputs/bundle/productionRelease/app-production-release.aab'
track: 'internal'
releaseName: 'test connection'
isDraftRelease: true
And the error:
GooglePlayRelease
View raw log
Starting: GooglePlayRelease
==============================================================================
Task : Google Play - Release
Description : Release an app to the Google Play Store
Version : 4.244.0
Author : Microsoft Corporation
Help : .google-play
==============================================================================
Authenticated with Google Play and getting new edit
##[error]Error: Failed to upload the bundle /home/vsts/work/1/s/android/app/build/outputs/bundle/productionRelease/app-production-release.aab. Failed with message: GaxiosError: Version code 1 has already been used.
at Gaxios._request (/home/vsts/work/_tasks/GooglePlayRelease_8cf7cac0-620b-11e5-b4cf-8565e60f4d27/4.244.0/node_modules/gaxios/build/src/gaxios.js:129:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async JWT.requestAsync (/home/vsts/work/_tasks/GooglePlayRelease_8cf7cac0-620b-11e5-b4cf-8565e60f4d27/4.244.0/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18) {
response: [Object],
config: [Object],
code: 403,
errors: [Array]
}.
Finishing: GooglePlayRelease
I even tried building locally and used Android Studio to analyze the AAB and APK, both generate a manifest file where the version code is 2343... So Im really not sure why Google Play says it's 1
My auto-generated versionCode is actually 2343, not 1.
Im trying to release an android app via Azure Pipelines, but their GooglePlayRelease@4 task keeps throwing an error, saying I have already used version code 1. Thi is despite the fact that I dont set a static versioncode, but derive it from number of git commits:
def getVersionCode = { ->
"git rev-list --count HEAD"
.execute()
.text.trim()
.toInteger()
}
defaultConfig {
applicationId 'com.my_app.app'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode getVersionCode() // here, should be 2343
versionName getVersionName()
}
Here's the task. I believe the problem could be during the signing task:
- task: AndroidSigning@3
inputs:
apkFiles: '$(Agent.BuildDirectory)/s/android/app/build/outputs/bundle/productionRelease/app-production-release.aab'
apksignerArguments: "--min-sdk-version 23"
apksignerKeystoreFile: 'my-app.keystore'
apksignerKeystorePassword: $(storePassword)
apksignerKeystoreAlias: $(keyAlias)
apksignerKeyPassword: $(keyPassword)
- task: GooglePlayRelease@4
inputs:
serviceConnection: 'Google Play Store Connection'
applicationId: 'com.my_app.app'
action: 'SingleBundle'
bundleFile: '$(Agent.BuildDirectory)/s/android/app/build/outputs/bundle/productionRelease/app-production-release.aab'
track: 'internal'
releaseName: 'test connection'
isDraftRelease: true
And the error:
GooglePlayRelease
View raw log
Starting: GooglePlayRelease
==============================================================================
Task : Google Play - Release
Description : Release an app to the Google Play Store
Version : 4.244.0
Author : Microsoft Corporation
Help : https://marketplace.visualstudio/items?itemName=ms-vsclient.google-play
==============================================================================
Authenticated with Google Play and getting new edit
##[error]Error: Failed to upload the bundle /home/vsts/work/1/s/android/app/build/outputs/bundle/productionRelease/app-production-release.aab. Failed with message: GaxiosError: Version code 1 has already been used.
at Gaxios._request (/home/vsts/work/_tasks/GooglePlayRelease_8cf7cac0-620b-11e5-b4cf-8565e60f4d27/4.244.0/node_modules/gaxios/build/src/gaxios.js:129:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async JWT.requestAsync (/home/vsts/work/_tasks/GooglePlayRelease_8cf7cac0-620b-11e5-b4cf-8565e60f4d27/4.244.0/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18) {
response: [Object],
config: [Object],
code: 403,
errors: [Array]
}.
Finishing: GooglePlayRelease
I even tried building locally and used Android Studio to analyze the AAB and APK, both generate a manifest file where the version code is 2343... So Im really not sure why Google Play says it's 1
Share Improve this question asked Mar 28 at 11:03 MikkelTMikkelT 8451 gold badge11 silver badges24 bronze badges 02 Answers
Reset to default 1Turns out ADO pipelines makes a shallow clone of the repo, which means that there's only 1 commit, thus causing `git rev-list --count HEAD` to return 1.
To fix it, force the pipeline to fetch everything:
- checkout: self
fetchDepth: 0
persistCredentials: true
clean: false
displayName: Checkout
- script: |
git rev-list --count HEAD
displayName: "git count"
A shallow clone may be necessary to speed up clone performance.
Consider using gitversion in your pipeline to create a semantic version based on the repository tags and branch names.
本文标签:
版权声明:本文标题:android - Azure Devops Pipeline GooglePlayRelease@4 Failed with message: GaxiosError: Version code 1 has already been used - Sta 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744041659a2580763.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论