Skip to content

Instantly share code, notes, and snippets.

@austonpramodh
Created March 5, 2022 05:37
Show Gist options
  • Select an option

  • Save austonpramodh/2bd7974611fadff009471c093779f5ae to your computer and use it in GitHub Desktop.

Select an option

Save austonpramodh/2bd7974611fadff009471c093779f5ae to your computer and use it in GitHub Desktop.
#!/bin/bash
# exit when any command fails
# set -e
echo "Android bundle build script!!"
# Alias tools for better code
bundletool="java -jar bundletool-all-1.8.2.jar"
# Remove gradle caches
echo "deleting .gradle caches!"
rm -rf $HOME/.gradle/caches
# Change directory to android
echo "Starting to build..."
cd "../android"
# Clean the gradlew
./gradlew clean
# Build the aab bundle
./gradlew bundleRelease
# Change directory back to Temp
cd "../temp"
# Create folders for data
mkdir -p data
# Move the aab bundle to data folder
cp ../android/app/build/outputs/bundle/release/app-release.aab data/app-release.aab
# Create apks
echo "Creating APKs..."
$bundletool build-apks --bundle=./data/app-release.aab \
--output=./data/my_app.apks \
--ks=./keystore.keystore \
--ks-pass=pass:clickass \
--ks-key-alias=alias_name
# Uninstall the old app if installed
adb uninstall com.saarthiapp
# Install the apks on emulator
echo "Install the apk"
$bundletool install-apks --apks=./data/my_app.apks
# Clean up
echo "Deleting the data folder!!"
rm -rf ./data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment