Update android tutorial to clarify android sdk path options
The android_sdk_repository path parameter is now optional, and for most setups it is easier to omit it and rely on the `ANDROID_HOME` environment variable. Updated this part of the tutorial to clarify this.
Closes #2632.
--
Reviewed-on: https://github.com/bazelbuild/bazel/pull/2632
PiperOrigin-RevId: 149337570
MOS_MIGRATED_REVID=149337570
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index d2673c8..b95bbdd 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -57,6 +57,7 @@
Damien Martin-Guillerez <dmarting@google.com>
Carl Mastrangelo <carl-mastrangelo@users.noreply.github.com>
Michajlo Matijkiw <michajlo@google.com>
+Iain McGinniss <iainmcgin@google.com>
Julio Merino <jmmv@google.com>
Adam Michael <ajmichael@google.com>
Liam Miller-Cushon <cushon@google.com>
diff --git a/site/versions/master/docs/tutorial/android-app.md b/site/versions/master/docs/tutorial/android-app.md
index dcb8376..df69e25 100644
--- a/site/versions/master/docs/tutorial/android-app.md
+++ b/site/versions/master/docs/tutorial/android-app.md
@@ -67,12 +67,25 @@
```python
android_sdk_repository(
name = "androidsdk",
- # Replace with path to Android SDK on your system
- path = "/Users/username/Library/Android/sdk",
- # Replace with the Android SDK API level
- api_level = 23,
- # Replace with the version in sdk/build-tools/
- build_tools_version="23.0.0"
+ # Replace with your installed Android SDK API level
+ api_level = 25
+)
+```
+
+This will use the Android SDK specified referenced by the `ANDROID_HOME`
+environment variable, and automatically detect the latest build tools
+version installed within that location.
+
+Alternatively, you can explicitly specify the location of the Android
+SDK and build tools version to use by including the `path` and
+`build_tools_version` attributes:
+
+```python
+android_sdk_repository(
+ name = "androidsdk",
+ path = "/path/to/Android/sdk",
+ api_level = 25,
+ build_tools_version = "25.0.1"
)
```
@@ -85,8 +98,6 @@
```python
android_ndk_repository(
name = "androidndk",
- # Replace with path to Android NDK on your system
- path = "/Users/username/Library/Android/ndk",
# Replace with the Android NDK API level
api_level = 21
)
@@ -98,6 +109,10 @@
[This web page](https://developer.android.com/ndk/guides/stable_apis.html)
contains a map from Android releases to NDK-supported API levels.
+Similar to `android_sdk_repository`, the path to the Android NDK is inferred from
+the `ANDROID_NDK_HOME` environment variable by default. The path can also be
+explicitly specified with a `path` attribute on `android_ndk_repository`.
+
## Create a BUILD file
A [`BUILD` file](/docs/build-ref.html#BUILD_files) is a text file that describes