Skip to content

Commit

Permalink
android build: Cut obsolete version-code-per-ABI hack
Browse files Browse the repository at this point in the history
This bit of code doesn't currently do anything, because we build a
single APK for all devices.  It would if we started building split
APKs per ABI.

This sort of thing was required for publishing an app as multiple APKs
on Google Play.  (The docs link in the comment is broken; a current
version appears to be:
  https://developer.android.com/google/play/publishing/multiple-apks#VersionCodes
.)  Google Play would use the different version codes as tiebreakers
to decide which APK to give to a device when several were supported.

But on Google Play, publishing multiple APKs has been obsolete for
years.  Instead, one uploads a single AAB, "Android App Bundle", and
then Google slices and dices that into separate APKs for the per-ABI
files, the per-screen-density files, the per-screen-size files, and
so on.  Each device downloads the specific combination of those pieces
that applies to it.

We never did publish multiple APKs on Google Play, and because it's
now obsolete we never will; we've been using AABs since zulip#3547 in 2020.

We do intend to start publishing multiple APKs, which would cause this
bit of code to start having an effect.  But this convention doesn't
seem to be useful anywhere else: for a user installing directly from
our GitHub release it's invisible and unhelpful, and the one known
downstream distributor of our APKs plans to just distribute the one
most widely-supported of them anyway:
  zulip#1270 (comment)
which will make this hack have no use there either.

So it seems like messing with the version codes like this would only
cause confusion.  Instead, just let the different per-ABI APKs for a
given release have the same version code as each other, and as the AAB
does.  That way the next release after v27.181 will have version code
simply 182, rather than 182003 et al.
  • Loading branch information
gnprice committed Mar 14, 2022
1 parent 069c82c commit 0107348
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"

import com.android.build.OutputFile

/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
Expand Down Expand Up @@ -200,21 +197,6 @@ android {
}
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}
}
}
}

repositories {
Expand Down

0 comments on commit 0107348

Please sign in to comment.