mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Fixed version code not found exception while publishing bundle on play store
This commit is contained in:
parent
71f851821a
commit
53d4ac1847
@ -120,12 +120,12 @@ class Transaction(
|
||||
}).execute().prettyPrint()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun addBundleToTrackInDraft(versionCode: Int, versionName: String?): Track =
|
||||
fun addBundleToTrackInDraft(versionCode: Int?, versionName: String?): Track =
|
||||
publisher.edits().tracks().update(packageName, editId, "internal", Track().apply {
|
||||
releases = listOf(TrackRelease().apply {
|
||||
status = "draft"
|
||||
name = versionName
|
||||
versionCodes = listOf(versionCode.toLong())
|
||||
versionCodes = listOf(versionCode?.toLong())
|
||||
})
|
||||
track = "internal"
|
||||
}).execute().prettyPrint()
|
||||
|
@ -36,7 +36,7 @@ android {
|
||||
}
|
||||
File("$projectDir/../install_time_asset_for_dwds/src/main/assets", "$name.zim").let {
|
||||
createDownloadTaskForPlayAssetDelivery(it)
|
||||
createPublishBundleWithAssetPlayDelivery(applicationVariants)
|
||||
createPublishBundleWithAssetPlayDelivery()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -48,11 +48,6 @@ android {
|
||||
enableSplit = false
|
||||
}
|
||||
}
|
||||
splits {
|
||||
abi {
|
||||
isUniversalApk = true
|
||||
}
|
||||
}
|
||||
assetPacks += ":install_time_asset_for_dwds"
|
||||
}
|
||||
|
||||
@ -192,9 +187,7 @@ fun DomainObjectSet<ApplicationVariant>.releaseVariantsFor(productFlavor: Produc
|
||||
find { it.name.equals("${productFlavor.name}Release", true) }!!
|
||||
.outputs.filterIsInstance<ApkVariantOutput>().sortedBy { it.versionCodeOverride }
|
||||
|
||||
fun ProductFlavor.createPublishBundleWithAssetPlayDelivery(
|
||||
applicationVariants: DomainObjectSet<ApplicationVariant>
|
||||
): Task {
|
||||
fun ProductFlavor.createPublishBundleWithAssetPlayDelivery(): Task {
|
||||
val capitalizedName =
|
||||
name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else "$it" }
|
||||
return tasks.create("publish${capitalizedName}ReleaseBundleWithPlayAssetDelivery") {
|
||||
@ -205,8 +198,6 @@ fun ProductFlavor.createPublishBundleWithAssetPlayDelivery(
|
||||
println("packageName $packageName")
|
||||
createPublisher(File(rootDir, "playstore.json"))
|
||||
.transactionWithCommit(packageName) {
|
||||
val variants =
|
||||
applicationVariants.releaseVariantsFor(this@createPublishBundleWithAssetPlayDelivery)
|
||||
val generatedBundleFile =
|
||||
File(
|
||||
"$buildDir/outputs/bundle/${capitalizedName.lowercase(Locale.getDefault())}" +
|
||||
@ -214,7 +205,7 @@ fun ProductFlavor.createPublishBundleWithAssetPlayDelivery(
|
||||
)
|
||||
if (generatedBundleFile.exists()) {
|
||||
uploadBundle(generatedBundleFile)
|
||||
addBundleToTrackInDraft(variants[0].versionCode, versionName)
|
||||
addBundleToTrackInDraft(versionCode, versionName)
|
||||
} else {
|
||||
throw FileNotFoundException("Unable to find generated aab file")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user