Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure all devices get 32-bit and 64-bit ABIs from the Play Store #951

Merged
merged 6 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,16 @@ android {
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
// Build type for intel devices (chromebooks and rare phones)
intel {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
matchingFallbacks = ['release']
ndk {
abiFilters "x86", "x86_64"
}
}
debug {
// We need to set this to null so that we can override it for variants
signingConfig signingConfigs.debug
Expand All @@ -317,6 +327,12 @@ android {
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// The special intel (x86) build type needs to have a different
// version code to the release build type if they are to be
// published alongside each other on the Play Store
if (variant.buildType.name == "intel") {
output.versionCodeOverride = 1048576 + defaultConfig.versionCode
}
// 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.
Expand Down
10 changes: 6 additions & 4 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ workflows:
before_run:
- primary
envs:
- GRADLE_TASKS: assembleApp assembleIccaRelease bundleAppUniversal -x assembleAppDebug
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so just to clarify, this is replacing the command that builds the aab with the commands to build the apks instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I define the tasks in the environment variable so that I can share the same build code for the different builds (internal, release candidate, and release). The naming of these is ${task}${flavor}${builtType}. I removed the bundleAppUniversal task which would create a .aab of the "app" flavor and "universal" build type (the universal build type includes both arm and x86, 32- and 64-bit). I replaced it with the assembleAppUniversal task which builds the same but as a .apk. I also added a new built type intel which only includes the x86 binaries. When publishing multiple APKs to the Play Store they must not overlap (e.g. we could not publish the release build (which is only Arm) and the universal build, because the universal build includes Arm as well as x86.

- GRADLE_TASKS: assembleApp assembleIccaRelease assembleAppUniversal assembleAppIntel -x assembleAppDebug
opts:
is_expand: false
steps:
Expand Down Expand Up @@ -112,6 +112,7 @@ workflows:
# Uppercase flavor or remove
filename="${filename/-qa-/-QA-}"
filename="${filename/-icca-release/-ICCA}"
filename="${filename/-app-intel/-x86}"
filename="${filename/-app-release/}"
filename="${filename/-app-/-}"
# Construct path with new filename
Expand Down Expand Up @@ -142,10 +143,12 @@ workflows:
RELEASE_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*[0-9]\.apk)
UNIVERSAL_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*[0-9]-universal\.apk)
ICCA_RELEASE_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*ICCA\.apk)
INTEL_RELEASE_APK_PATH=$(echo -n "${BITRISE_APK_PATH_LIST//|/$'\n'}" | grep mapeo-.*x86\.apk)

envman add --key RELEASE_APK_PATH --value "$RELEASE_APK_PATH"
envman add --key UNIVERSAL_APK_PATH --value "$UNIVERSAL_APK_PATH"
envman add --key ICCA_RELEASE_APK_PATH --value "$ICCA_RELEASE_APK_PATH"
envman add --key INTEL_RELEASE_APK_PATH --value "$INTEL_RELEASE_APK_PATH"
- [email protected]:
title: Upload APK for Arm
inputs:
Expand Down Expand Up @@ -200,12 +203,11 @@ workflows:
- files_to_upload: $RELEASE_APK_PATH
- body: "See [changelog](https://github.com/digidem/mapeo-mobile/blob/develop/CHANGELOG.md) for a detailed list of changes"
- api_token: $GITHUB_TOKEN
- google-play-deploy@3.0.2:
- google-play-deploy@3.7.2:
inputs:
- service_account_json_key_path: $BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL
- track: beta
- apk_path: $RELEASE_APK_PATH
- app_path: $BITRISE_AAB_PATH
- app_path: $RELEASE_APK_PATH|$INTEL_RELEASE_APK_PATH
- package_name: com.mapeo
meta:
bitrise.io: null
Expand Down