-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup-android.sh
More file actions
executable file
·60 lines (52 loc) · 1.38 KB
/
cleanup-android.sh
File metadata and controls
executable file
·60 lines (52 loc) · 1.38 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# cleanup-android.sh - Undo Android build artifacts and NDK installation
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ANDROID_NDK_VERSION="28.2.13676358"
APP_NAME="marchat-gui"
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
print_status() {
echo -e "${GREEN}[INFO]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Remove generated APKs
cleanup_apks() {
print_status "Removing generated APKs..."
cd "$SCRIPT_DIR"
shopt -s nullglob
APKS=(*.apk)
if [ ${#APKS[@]} -gt 0 ]; then
rm -f *.apk
print_status "Removed ${#APKS[@]} APK(s)"
else
print_status "No APK files to remove"
fi
}
# Remove installed NDK
cleanup_ndk() {
if [ -z "$ANDROID_HOME" ]; then
if [ -d "$HOME/Android/Sdk" ]; then
export ANDROID_HOME="$HOME/Android/Sdk"
else
print_status "ANDROID_HOME not set and SDK not found; skipping NDK cleanup"
return
fi
fi
NDK_PATH="$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION"
if [ -d "$NDK_PATH" ]; then
print_status "Removing NDK $ANDROID_NDK_VERSION..."
rm -rf "$NDK_PATH"
print_status "NDK removed"
else
print_status "NDK $ANDROID_NDK_VERSION not found; nothing to remove"
fi
}
### MAIN ###
print_status "Starting cleanup..."
cleanup_apks
cleanup_ndk
print_status "Cleanup complete!"