Andrew Fletcher published: 29 August 2023 (updated) 29 September 2023 2 minutes read
Each time a release is prepared for Google Play, the steps I work through are as follows.
Preparation to run a build
Check the Gradle build settings
Directed to the build.gradle file using the following file path
~/android/app/The area of code in the build-gradle file to focus:
android {
signingConfigs {
debug {
storeFile file('{file-path}/private_key.pepk')
storePassword '{password}'
keyAlias '{alias}'
keyPassword '{password}'
}
release {
storeFile file('{file-path}/Android-keys/{project}/private_key.pepk')
storePassword '{password}'
keyAlias '{alias}'
keyPassword '{password}'
}
}
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId '{application-id}'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode {build-number}
versionName '{version}'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/{base-code}/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
versionNameSuffix '0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
jniDebuggable false
renderscriptDebuggable false
}
debug {
debuggable false
jniDebuggable false
renderscriptDebuggable false
minifyEnabled false
}
}
}As each build is prepared, update the versionCode. Currently defined above as {build-number}, and increment by one.
Running a build
In Android Studio, go to
build > Generate Signed Bundle / APK...Select Android App Bundle
Click Next
Check the following fields
Key store path: {path}/{key}.jks
Key store password: {keystore-password}
Key alias: {key-alias}
Key password: {key-password}
check - Remember passwords
uncheck - Export encrypted key for enrolling published apps in Google Play App SigningClick Next
The script will run creating a release. Once completed and successful, either click on locate in the pop-up window or go to the directory
~/android/app/release/Upload or drag and drop this file on to your Google Play environment.