I've got a project set up at Huawei AppGallery and want to make a Gradle plugin that uploads a new version of a Release APK file into the project without submitting it for approval, using Huawei Connect API (just upload a new version, not publish actual update to the users). Right now there is an older version of the android apk at HuaweiAppGallery.
This is what I've got so far. With huaweiService
instance it just calls endpoints of Connect API:
// get access token
val token = huaweiService.getToken(
clientId = clientId,
clientSecret = clientSecret
)
// get app id
val appInfo = huaweiService.getAppID(
clientId = clientId,
token = token,
packageName = variant.applicationId
)
val uploadUrl = huaweiService.getUploadApkUrl(
clientId = clientId,
token = token,
appId = appInfo.value
)
// upload apk file
val fileInfoListResult = huaweiService.uploadApkFile(
uploadUrl = uploadUrl.uploadUrl,
authCode = uploadUrl.authCode,
apkFile = apkFile
)
// update app info
val fileInfoRequestList = mapFileInfo(fileInfoListResult, apkFileName)
val appId = appInfo.value
huaweiService.updateAppFileInformation(
clientId = clientId,
token = token,
appId = appId,
fileInfoRequestList = fileInfoRequestList
)
The issues I've run into are:
APK file upload request actually succeeds,
uploadApkFile
returns a download url inside a result (I can even download APK with this url), but this APK file is not appearing inside Huawei AppGallery, where all APK versions of the app appear when I load them manually. So I can't submit it for release approval.updateAppFileInformation
method executed after uploading APK fails with error:[cds]add apk failed, additional msg is [package name already exists]
Why is it telling me that package name already exists? I know that it does, there is an older version of my app already uploaded, which I just want to update. Ho do I upload a newer version of a Release APK into AppGallery correctly so that I could take it and submit for release manually after that?