Add helpful examples to Android test env validation failure messages.

Summary:
Hi there!

I set up the repo because I want to do a little contribution to the Android side but ran into trouble [running tests](https://facebook.github.io/react-native/docs/contributing.html). The Android environment validation kept failing. While the messages were a little helpful, it would have saved me a bit of time and research if I had some helpful examples to copy-and-paste. In my case, I'm using Android SDK Tools on the command line. Hopefully, this will help others when setting up!

Run `./scripts/run-android-local-unit-tests.sh` with each of the following to see the expanded help messages:

* Make sure `$ANDROID_HOME/platforms/android-$MAJOR` is _not_ present.
* Make sure `$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION` is _not_ present.
* Make sure `JAVA_HOME` is _not_ set and/or is _not_ in `PATH`.
Closes https://github.com/facebook/react-native/pull/16222

Differential Revision: D6044875

Pulled By: ericnakagawa

fbshipit-source-id: febacbd08fb632b349c352035f24eed891fbd154
This commit is contained in:
Alex Hernandez 2017-10-12 15:28:25 -07:00 committed by Facebook Github Bot
parent fe62da34a6
commit ff908aa9fc
1 changed files with 15 additions and 1 deletions

View File

@ -54,6 +54,11 @@ if [ ! -e "$PLATFORM_DIR" ]; then
echo "Specifically, the directory $PLATFORM_DIR does not exist."
echo "You probably need to specify the right version using the SDK Manager from within Android Studio."
echo "See https://facebook.github.io/react-native/docs/getting-started.html for details."
echo "If you are using Android SDK Tools from the command line, you may need to run:"
echo
echo " sdkmanager \"platform-tools\" \"platform-tools;android-$MAJOR\""
echo
echo "Check out https://developer.android.com/studio/command-line/sdkmanager.html for details."
exit 1
fi
@ -64,6 +69,11 @@ if [ ! -e "$BT_DIR" ]; then
echo "Specifically, the directory $BT_DIR does not exist."
echo "You probably need to explicitly install the correct version of the Android SDK Build Tools from within Android Studio."
echo "See https://facebook.github.io/react-native/docs/getting-started.html for details."
echo "If you are using Android SDK Tools from the command line, you may need to run:"
echo
echo " sdkmanager \"platform-tools\" \"build-tools;android-$BUILD_TOOLS_VERSION\""
echo
echo "Check out https://developer.android.com/studio/command-line/sdkmanager.html for details."
exit 1
fi
@ -80,7 +90,11 @@ if [ -n "$(which csrutil)" ]; then
echo "See https://our.intern.facebook.com/intern/dex/installing-java-8/ for instructions on installing Java 8 on FB laptops."
else
echo "Check out http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html ."
echo "Be sure that you set JAVA_HOME and PATH correctly."
echo "Be sure that you set JAVA_HOME and PATH correctly in your .bashrc or equivalent. Example:"
echo
echo " export JAVA_HOME=path/to/java"
echo " export PATH=\$PATH:\$JAVA_HOME/bin"
echo
fi
echo "After installing Java, run 'buck kill' and 'buck clean'."
exit 1