diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index d53af97bee..8fcb69b6c0 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -45,7 +45,7 @@ steps: branches: "master" plugins: - docker#v3.1.0: - image: "runmymind/docker-android-sdk" + image: "runmymind/docker-android-sdk" # Code quality diff --git a/tools/sign_apk.sh b/tools/sign_apk.sh new file mode 100755 index 0000000000..7f421c15f4 --- /dev/null +++ b/tools/sign_apk.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -e + +if [[ -z "${ANDROID_HOME}" ]]; then + echo "Env variable ANDROID_HOME is not set, should be set to something like ~/Library/Android/sdk" + exit 1 +fi + +if [[ "$#" -ne 2 ]]; then + echo "Usage: $0 KEYSTORE_PATH APK" >&2 + exit 1 +fi + +# Get the command line parameters +PARAM_KEYSTORE_PATH=$1 +PARAM_APK=$2 + +# Other params +BUILD_TOOLS_VERSION="28.0.3" +MIN_SDK_VERSION=19 + +echo "Signing APK with build-tools version ${BUILD_TOOLS_VERSION} for min SDK version ${MIN_SDK_VERSION}..." + +APK_SIGNER_PATH=${ANDROID_HOME}/build-tools/${BUILD_TOOLS_VERSION} + +${APK_SIGNER_PATH}/apksigner sign \ + -v \ + --ks ${PARAM_KEYSTORE_PATH} \ + --min-sdk-version ${MIN_SDK_VERSION} \ + ${PARAM_APK} + +# Verify the signature +echo "Verifying the signature..." + +# Note: we ignore warning on META-INF files +${APK_SIGNER_PATH}/apksigner verify \ + -v \ + --min-sdk-version ${MIN_SDK_VERSION} \ + ${PARAM_APK} \ + | grep -v "WARNING: META-INF/" + +echo +echo "Congratulations! The APK ${PARAM_APK} is now signed!" diff --git a/vector/build.gradle b/vector/build.gradle index 7170dfac76..b4f27d7eb0 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -12,9 +12,9 @@ androidExtensions { experimental = true } -def versionMajor = 0 -def versionMinor = 1 -def versionPatch = 0 +ext.versionMajor = 0 +ext.versionMinor = 1 +ext.versionPatch = 0 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct' @@ -63,7 +63,11 @@ android { minSdkVersion 19 targetSdkVersion 28 multiDexEnabled true - versionCode generateVersionCodeFromTimestamp() + + // For release, use generateVersionCodeFromVersionName() + // versionCode generateVersionCodeFromTimestamp() + versionCode generateVersionCodeFromVersionName() + versionName "${versionMajor}.${versionMinor}.${versionPatch}" buildConfigField "String", "GIT_REVISION", "\"${gitRevision()}\""