-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_apk.sh
More file actions
executable file
·28 lines (22 loc) · 874 Bytes
/
Copy pathbuild_apk.sh
File metadata and controls
executable file
·28 lines (22 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -e
echo "=== Installing Java JDK 21 and build tools ==="
apt-get update
apt-get install -y openjdk-21-jdk unzip wget git
echo "=== Setting up Android SDK ==="
mkdir -p /opt/android-sdk/cmdline-tools
cd /opt/android-sdk/cmdline-tools
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q commandlinetools-linux-11076708_latest.zip
mv cmdline-tools latest
export ANDROID_HOME=/opt/android-sdk
export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
echo "=== Accepting licenses ==="
mkdir -p /opt/android-sdk/licenses
yes | sdkmanager --licenses || true
echo "=== Building APK ==="
cd /project/android
./gradlew assembleDebug
echo "=== Copying compiled APK ==="
cp app/build/outputs/apk/debug/app-debug.apk /project/app-debug.apk
echo "=== Build Succeeded! APK copied to project root as app-debug.apk ==="