Update the Android development enviornment setup

1. Update `ANDROID_SDK_ROOT` to `ANDROID_HOME`. The former variable is
   deprecated. (see https://developer.android.com/tools/variables#envar)
2. Remove `ANDROID_NDK_HOME` environment variable. This should allow the
   build script to work out of the box for more folks.
3. Check that Java is on the `PATH` as opposed to just installing it.
   `asdf` and other runtime management tools are pretty popular, and all
   we care about is that the Java version is accessible.
4. Remove calls to `sudo`. Check to see if CocoaPods exists, if it
   doesn't install it using Homebrew which doesn't require `sudo`.
This commit is contained in:
Salvatore Testa 2023-11-12 13:47:17 -08:00
parent 7d1b789d38
commit 38d9610c6b
No known key found for this signature in database
8 changed files with 69 additions and 81 deletions

View file

@ -24,31 +24,24 @@ while true; do
case $response in
[yY] ) echo Checking android setup...;
# ensure ANDROID_SDK_ROOT is defined and exists
if [ -d "$ANDROID_SDK_ROOT" ]; then
echo '[X] $ANDROID_SDK_ROOT is defined and exists'
# ensure ANDROID_HOME is defined and exists
if [ -d "$ANDROID_HOME" ]; then
echo '[X] $ANDROID_HOME is defined and exists'
else
echo '$ANDROID_SDK_ROOT is not defined or does not exist'
echo '$ANDROID_HOME is not defined or does not exist'
exit 1
fi
# ensure Android Command Line Tools exist
if [ -d "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin" ]; then
if [ -d "$ANDROID_HOME/cmdline-tools/latest/bin" ]; then
echo '[X] Android command line tools are installed'
else
echo 'Android command line tools are not installed'
exit 1
fi
# ensure ANDROID_NDK_HOME is defined and exists
if [ -d "$ANDROID_NDK_HOME" ]; then
echo '[X] $ANDROID_NDK_HOME is defined and exists'
else
echo '$ANDROID_NDK_HOME is not defined or does not exist'
exit 1
fi
# ensure ndk is installed
ANDROID_NDK_HOME="$ANDROID_HOME/ndk/25.1.8937393"
if [ -f "$ANDROID_NDK_HOME/ndk-build" ]; then
echo '[X] Android NDK is installed at the location $ANDROID_NDK_HOME'
else
@ -57,7 +50,7 @@ while true; do
fi
# ensure cmake is installed
if [ -d "$ANDROID_SDK_ROOT/cmake" ]; then
if [ -d "$ANDROID_HOME/cmake" ]; then
echo '[X] Android SDK CMake is installed'
else
echo 'Android SDK CMake is not installed'
@ -65,7 +58,7 @@ while true; do
fi
# ensure emulator is installed
if [ -d "$ANDROID_SDK_ROOT/emulator" ]; then
if [ -d "$ANDROID_HOME/emulator" ]; then
echo '[X] Android SDK emulator is installed'
else
echo 'Android SDK emulator is not installed'