My current workflow is I publish my apks (4 splits by abi) to alpha in draft. This works fine because I am using Gradle Play Publisher.
The next step is I upload the expansion file, this is a custom gradle task.
I start an edit with an authenticated AndroidPublisher
val editId=publisher.edits().insert(packageName, null).execute().id
For my first apkVariant I upload the expansion file
publisher.edits().expansionfiles()
.upload(
packageName,
editId,
apkVariantOutput.versionCodeOverride,
"main",
FileContent("application/octet-stream",myFile)
).execute()
and for all subsequent variants I reference the new expansion file
publisher.edits().expansionfiles().update(
packageName,
editId,
apkVariantOutput.versionCodeOverride,
"main",
ExpansionFile().apply {
referencesVersion = apkVariants[0].versionCodeOverride
}
).execute()
and finally commit this edit
publisher.edits().commit(packageName, editId).execute()
example output from some prints:
{
"expiryTimeSeconds" : "1573666146",
"id" : "04893130212727174754"
}
setting expansion for 6193171
{
"fileSize" : "590199"
}
{
"referencesVersion" : 6193171
}
{
"referencesVersion" : 6193171
}
{
"referencesVersion" : 6193171
}
{
"expiryTimeSeconds" : "1573666146",
"id" : "04893130212727174754"
}
But the expansion files never show up on the Play console even though the task completes without error.
I hope I am fundamentally misunderstanding something about this API because I can't make sense of this.