From f1b537ae1e8928a36929be72f2b7789e0807303c Mon Sep 17 00:00:00 2001 From: Lukacs Berki Date: Tue, 22 Sep 2015 12:18:09 +0000 Subject: Enhance the tutorial by adding information about setting up the Android NDK. -- MOS_MIGRATED_REVID=103637048 --- site/docs/tutorial/android-app.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'site') diff --git a/site/docs/tutorial/android-app.md b/site/docs/tutorial/android-app.md index 252bf6d463..4b4a59dcbc 100644 --- a/site/docs/tutorial/android-app.md +++ b/site/docs/tutorial/android-app.md @@ -53,7 +53,7 @@ Bazel needs to run the Android SDK [build tools](https://developer.android.com/tools/revisions/build-tools.html) and uses the SDK libraries to build the app. This means that you need to add some information to your `WORKSPACE` file so that Bazel knows where to find -them. Note that this step is not required when you build all types of outputs. +them. Note that this step is not required when you build for other platforms. For example, Bazel automatically detects the location of Java, C++ and Objective-C compilers from settings in your environment. @@ -71,6 +71,27 @@ android_sdk_repository( ) ``` +If you want to compile native code into your Android app, you also need download +the [Android NDK](https://developer.android.com/ndk/downloads/index.html) and +tell Bazel where to find it by adding the following stanza to your `WORKSPACE` +file: + +```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 +) +``` + +"API level" is the version of the Android API the SDK and the NDK target +(for example, 19 for Android K and 21 for Android L). It's not necessary to set +the API levels to the same value for the SDK and NDK. +[This web page](https://developer.android.com/ndk/guides/stable_apis.html) +contains a map from Android releases to NDK-supported API levels. + ## Create a BUILD file A [`BUILD` file](/docs/build-ref.html#BUILD_files) is a text file that describes -- cgit v1.2.3