-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from ukanth/automate-apk-build
Added script to automate apk build
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ | |
/build | ||
/captures | ||
.externalNativeBuild | ||
/app/output | ||
/app/build/outputs/apk/release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# Get the directory of the script | ||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
# echo "The script directory is: $SCRIPT_DIR" | ||
|
||
# Define project and output directories using the script's directory | ||
PROJECT_DIR="$(cd "$(dirname "$SCRIPT_DIR")" && pwd)" | ||
OUTPUT_DIR="$SCRIPT_DIR/output/" | ||
# echo "The project directory is : $PROJECT_DIR" | ||
|
||
# Create the output directory if it doesn't exist | ||
mkdir -p "$OUTPUT_DIR" | ||
|
||
# Navigate to the project directory | ||
cd "$PROJECT_DIR" | ||
|
||
# Clean the project | ||
./gradlew clean | ||
|
||
# Define the path to your keystore.properties file (update as needed) | ||
KEYSTORE_PROPERTIES_FILE="$PROJECT_DIR/keystore.properties" | ||
|
||
# Check if the keystore.properties file exists | ||
if [ -f "$KEYSTORE_PROPERTIES_FILE" ]; then | ||
echo "Using keystore.properties file for signing." | ||
else | ||
echo "Error: keystore.properties file not found. Please create one with the keystore information." | ||
exit 1 | ||
fi | ||
|
||
# Build the release APK | ||
./gradlew assembleRelease -Pkeystore.properties="$KEYSTORE_PROPERTIES_FILE" | ||
|
||
# Copy the APK to the output directory | ||
cp "$PROJECT_DIR/app/build/outputs/apk/release/app-release.apk" "$OUTPUT_DIR" | ||
|
||
# Notify completion | ||
echo "APK build complete and copied to $OUTPUT_DIR" |