-
Notifications
You must be signed in to change notification settings - Fork 24.3k
/
validate-android-sdk.sh
executable file
·51 lines (44 loc) · 2.5 KB
/
validate-android-sdk.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
#!/bin/bash
# This script validates that the Android SDK is installed correctly.
# This means setting ANDROID_HOME and adding its subdirectories to PATH.
# If the Android SDK is not installed correctly, this script exits
# with an error and a helpful message is printed.
if [ -z "$ANDROID_HOME" ]; then
echo "Error: \$ANDROID_HOME is not configured."
echo "You must first install the Android SDK and then set \$ANDROID_HOME."
echo "If you already installed the Android SDK, the problem is that you need to export ANDROID_HOME from your .bashrc or equivalent."
echo "See https://facebook.github.io/react-native/docs/getting-started.html for instructions."
exit 1
fi
if [ ! -d "$ANDROID_HOME" ]; then
echo "Error: \$ANDROID_HOME = $ANDROID_HOME but that directory does not exist."
echo "It is possible that you installed then uninstalled the Android SDK."
echo "In that case, you should reinstall it."
echo "See https://facebook.github.io/react-native/docs/getting-started.html for instructions."
exit 1
fi
if [ ! -e "$ANDROID_HOME/tools/emulator" ]; then
echo "Error: could not find an emulator at \$ANDROID_HOME/tools/emulator."
echo "Specifically, $ANDROID_HOME/tools/emulator does not exist."
echo "This indicates something is borked with your Android SDK install."
echo "One possibility is that you have \$ANDROID_HOME set to the wrong value."
echo "If that seems correct, you might want to try reinstalling the Android SDK."
echo "See https://facebook.github.io/react-native/docs/getting-started.html for instructions."
exit 1
fi
if [ -z `which emulator` ]; then
echo "Error: could not find 'emulator'. Specifically, 'which emulator' was empty."
echo "However, the emulator seems to be installed at \$ANDROID_HOME/tools/emulator already."
echo "This means that the problem is that you are not adding \$ANDROID_HOME/tools to your \$PATH."
echo "You should do that, and then rerun this command."
echo "Sorry for not fixing this automatically - we just didn't want to mess with your \$PATH automatically because that can break things."
exit 1
fi
if [ -z `which adb` ]; then
echo "Error: could not find 'adb'. Specifically, 'which adb' was empty."
echo "This indicates something is borked with your Android SDK install."
echo "The most likely problem is that you are not adding \$ANDROID_HOME/platform-tools to your \$PATH."
echo "If all else fails, try reinstalling the Android SDK."
echo "See https://facebook.github.io/react-native/docs/getting-started.html for instructions."
exit 1
fi