30 lines
1.1 KiB
Bash
Executable File
30 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Get the root directory of the project (one level up from scripts directory)
|
|
ROOT_DIR=$(dirname "$(dirname "$(readlink -f "$0")")")
|
|
cd $ROOT_DIR
|
|
|
|
./prepare
|
|
rm -f ./app/build/outputs/apk/release/app-release-unsigned.apk
|
|
|
|
# Use Java 17 for Gradle build
|
|
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
|
|
export PATH=$JAVA_HOME/bin:$PATH
|
|
echo "Using Java for build: $(java -version 2>&1 | head -n 1)"
|
|
|
|
# Extract package name automatically from AndroidManifest.xml
|
|
export PACKAGE_NAME=$(grep -oP 'package="[^"]+"' ./app/src/main/AndroidManifest.xml | cut -d'"' -f2)
|
|
if [ -z "$PACKAGE_NAME" ]; then
|
|
echo "Error: Failed to extract package name from AndroidManifest.xml"
|
|
exit 1
|
|
fi
|
|
echo "Detected package name: $PACKAGE_NAME"
|
|
|
|
./scripts/prepare_libs.sh
|
|
|
|
./gradlew assembleRelease
|
|
rm -f ./app/build/outputs/apk/release/app-release-aligned-debugSigned.apk
|
|
uber-apk-signer -a ./app/build/outputs/apk/release/app-release-unsigned.apk
|
|
adb install ./app/build/outputs/apk/release/app-release-aligned-debugSigned.apk
|
|
|
|
adb shell monkey -p $PACKAGE_NAME -c android.intent.category.LAUNCHER 1 |