-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset-android-studio-mac.sh
55 lines (46 loc) · 1.75 KB
/
reset-android-studio-mac.sh
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
#!/usr/bin/env bash
# Manas Tungare <[email protected]>
# If any one command fails, immediately exit.
# Treat unset variables as an error, and immediately exit.
set -eu
export LANG=en_US.UTF-8
export TERM=xterm-256color
export CLICOLOR=yes
RED="\033[00;31m"
YELLOW="\033[01;33m"
NORMAL="\033[00m"
trap "echo -e \"\n${RED}Cancelling all operations.${NORMAL}\"; exit;" INT TERM
function message() {
echo -e "${YELLOW}$1${NORMAL}"
}
echo -e "⚠️ ${YELLOW}This will completely delete all Gradle & Android Studio caches & config, and will require you to re-import the project from scratch.${NORMAL}"
echo -n "Press Enter to confirm, or Ctrl+C to cancel… "
read ignorePressedKey
echo ""
# Check if this script is being run from the correct location.
if [ ! -f "./gradlew" ]; then
echo -e "${RED}“gradlew” not found at “$(pwd)”${NORMAL}"
echo "Consider running this script from the root of an Android Studio project."
echo -n "Press Enter to continue, or Ctrl+C to abort… "
read ignorePressedKey
echo ""
fi
# Script begins!
message "Killing ADB…"
adb kill-server
killall adb
message "Cleaning current project, including Gradle & Android Studio caches & config…"
pwd
./gradlew clean
./gradlew cleanBuildCache
./gradlew --stop
find . -iname ".idea" -print -exec rm -Rfv "{}" \;
find . -iname ".gradle" -print -exec rm -Rfv "{}" \;
find . -iname "build" -print -exec rm -Rfv "{}" \;
find . -iname "*.iml" -print -exec rm -Rfv "{}" \;
message "Deleting global state, including Gradle & Android Studio caches & config…"
rm -v ~/Library/Preferences/com.google.android.studio.plist
rm -Rfv ~/Library/Preferences/AndroidStudio*
rm -Rfv ~/Library/Application\ Support/AndroidStudio*
rm -Rfv ~/Library/Logs/AndroidStudio*
rm -Rfv ~/Library/Caches/AndroidStudio*