Solution 1 :
Your question is:
How do I upload a newer version of a Release APK into AppGallery
correctly?
First, you have already downloaded APK with the URL. Please make sure the Updating App File Information invoked within 5 minutes. Because the uploaded file is only available for 5 minutes before calling the Updating App File Information API.
Second, please perform the following steps to upload the newer version:
-
Step One: Obtaining the File Upload URL: This API is used to obtain the upload URLs of files including images, videos, and APK, RPK, and PDF files when developers need to upload these files.
-
Step Two: Uploading Files:This API is used to upload files from a client or server to the file server.
-
Step Three: Updating App File Information: This API is used to update app file information after images, videos, and APK and RPK files are uploaded.
-
Step Four: Submitting an App for Release: This API is used to submit a request for app approval. Before calling this API, ensure that the app information is complete and the app software package has been uploaded.
You can check whether the above two parts have solved your problem.
Problem :
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?
Comments
Comment posted by yabee-dabee
Thank you for your response. As for the second part of your answer, I’m doing exactly what you wrote, except for the step 4. I don’t want to submit the app for release with plugin, I just want to upload it so that I could manually submit it later from the Console. But the step 3 fails for me: I call Update App File Info request within 5 minutes after successful upload, but it fails with the error saying
Comment posted by zhangxaochen
@yabee-dabee Allright. Please check whether the package name is used by other applications and whether the transferred appid corresponds to the package name.
Comment posted by Fernando Prieto Moyano
Is there any solution to this @yabee-dabee and @shirley? I’ve got the same issue and everything seems to be correct in my setup.
Comment posted by this
@FernandoPrieto Will
Comment posted by plugin
I’ve wrote a Gradle