Skip to content

Commit

Permalink
build android app bundle .aab
Browse files Browse the repository at this point in the history
  • Loading branch information
poliha committed Apr 26, 2020
1 parent 1c07c0a commit a61dffd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ UserInterfaceState.xcuserstate
out
*.apk
.env*
dist/
dist/
*.aab
33 changes: 27 additions & 6 deletions scripts/android-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ set -e
source .env

UNSIGNED_APK="platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk"
UNSIGNED_AAB="platforms/android/app/build/outputs/bundle/release/app.aab"
VERSION=`node -pe "require('./package.json').version"`
RELEASE_FILE=saza-v$VERSION.apk
RELEASE_VERSION=saza-v$VERSION
AAB_RELEASE_FILE=$RELEASE_VERSION.aab
APK_RELEASE_FILE=$RELEASE_VERSION.apk


[[ -z "$SAZA_KEYSTORE" ]] && { echo "Error: SAZA_KEYSTORE not found"; exit 1; }
Expand All @@ -16,11 +19,29 @@ RELEASE_FILE=saza-v$VERSION.apk
echo "Building production release ..."
ionic cordova build android --prod --release

echo "Signing apk ..."
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $SAZA_KEYSTORE $UNSIGNED_APK $SAZA_KEYSTORE_ALIAS
echo "Build android app bundle aab ... "
cd platforms/android/
./gradlew bundle

echo "Run zipalign on apk ..."
~/Android/Sdk/build-tools/29.0.3/zipalign -f -v 4 $UNSIGNED_APK $RELEASE_FILE
cd ../..

if [[ "$SIGN_SAZA_RELEASE" = "false" ]]
then
echo "Not signing release ..."
cp $UNSIGNED_APK $APK_RELEASE_FILE
else
echo "Signing apk ..."
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $SAZA_KEYSTORE $UNSIGNED_APK $SAZA_KEYSTORE_ALIAS

echo "Signing aab ..."
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $SAZA_KEYSTORE $UNSIGNED_AAB $SAZA_KEYSTORE_ALIAS

echo "Run zipalign on apk ..."
~/Android/Sdk/build-tools/29.0.3/zipalign -f -v 4 $UNSIGNED_APK $APK_RELEASE_FILE
fi


cp $UNSIGNED_AAB $AAB_RELEASE_FILE

echo "Android production build completed..."
ls -alh $RELEASE_FILE
ls -alh $RELEASE_VERSION*

0 comments on commit a61dffd

Please sign in to comment.