Skip to content

Commit b7a3016

Browse files
Clarify Fenix building instructions (mozilla#7290)
* Clarify JAVA_HOME setup in Fenix building instructions Updated instructions for setting JAVA_HOME with a specific command. * Fix NDK instructions * Mention mozilla-central instead of mozilla-mobile/firefox-android * Updating building instructions based on pairing sessions over the last few days with android team * Simplifying instructions * Fixing casing and adding mac example Co-authored-by: Mathieu Leplatre <mathieu@mozilla.com> * Fixing casing Co-authored-by: Mathieu Leplatre <mathieu@mozilla.com> * Fixing casing Co-authored-by: Mathieu Leplatre <mathieu@mozilla.com> * Fixing casing Co-authored-by: Mathieu Leplatre <mathieu@mozilla.com> * Fixing casing Co-authored-by: Mathieu Leplatre <mathieu@mozilla.com> * Fixing casing and adding gradle example Co-authored-by: Mathieu Leplatre <mathieu@mozilla.com> --------- Co-authored-by: Alex Cottner <acottner@mozilla.com> Co-authored-by: Alex Cottner <148472676+alexcottner@users.noreply.github.com>
1 parent 3e6bb22 commit b7a3016

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎docs/building.md‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,25 @@ The following instructions assume that you are building `application-services` f
100100
[Fenix Auto-publication workflow for android-components and application-services](howtos/locally-published-components-in-fenix.md).
101101
102102
1. Install Android SDK, JAVA, NDK and set required env vars
103-
1. Clone the [firefox-android](https://github.com/mozilla-mobile/firefox-android) repository (**not** inside the Application Service repository).
104-
1. Install [Java **17**](https://www.oracle.com/java/technologies/downloads/#java17) for your system
105-
1. Set `JAVA_HOME` to point to the JDK 17 installation directory.
103+
1. [Bootstrap a Firefox for Android environment](https://firefox-source-docs.mozilla.org/mobile/android/index.html) (**not** inside the Application Service repository).
106104
1. Download and install [Android Studio](https://developer.android.com/studio/#downloads).
107-
1. Set `ANDROID_SDK_ROOT` and `ANDROID_HOME` to the Android Studio sdk location and add it to your rc file (either `.zshrc` or `.bashrc` depending on the shell you use for your terminal).
108-
1. Configure the required versions of NDK
109-
`Configure menu > System Settings > Android SDK > SDK Tools > NDK > Show Package Details > NDK (Side by side)`
110-
- 29.0.14206865 (required by Application Services, [as configured](https://github.com/mozilla/application-services/blob/main/build.gradle#L33))
105+
1. Configure Android Studio to use the bootstrapped SDK under `Settings > Languages & Frameworks > Android SDK`, set it to the SDK from mozbuild. Ex: `~/.mozbuild/android-sdk-linux` or `~/.mozbuild/android-sdk-macos`
106+
1. Download the required NDK and command-line tools under `Settings > Languages & Frameworks > Android SDK > SDK Tools`. Pick:
107+
1. NDK (Side by side) version 29.0.14206865 [as configured](https://github.com/mozilla/application-services/blob/bb8cde8a5/taskcluster/docker/linux/Dockerfile#L25)
108+
1. Android SDK Command-line Tools (latest)
109+
1. Set environment variables based on the boostrapped code and the downloaded NDK. Add it to your rc file (either `.zshrc` or `.bashrc` depending on your shell) to make it permanent
110+
1. Set `JAVA_HOME` to point to the bootstraped JDK 17 installation directory. Ex: `export JAVA_HOME=~/.mozbuild/jdk/jdk-17.0.18+8/`
111+
1. Set `ANDROID_HOME` to the bootstraped Android SDK. Ex: `export ANDROID_HOME=~/.mozbuild/android-sdk-linux`
112+
1. Set `NSS_STATIC` to 1. Ex: `export NSS_STATIC=1`
113+
1. Set `NSS_DIR` to your local NSS folder. Ex: `export NSS_DIR=~/Mozilla/application-services/libs/desktop/linux-x86-64/nss`
114+
1. Set `ANDROID_NDK_ROOT` to the NDK you downloaded via Android Studio, Ex: `export ANDROID_NDK_ROOT=~/.mozbuild/android-sdk-linux/ndk/29.0.14206865`
111115
1. If you are on Windows using WSL - drop to the section below, [Windows setup
112116
for Android (WSL)](building.md#windows-setup-for-android-via-wsl) before proceeding.
113117
1. Check dependencies, environment variables
114118
1. Run `./libs/verify-android-environment.sh`
115119
2. Follow instructions and rerun until it is successful.
116120
121+
**Note:** If you opened the application-services or Firefox repos in Android Studio, it likely added a `local.properties` or `gradle-daemon-jvm.properties` file that could override some of the environment variables above. If you experience build errors, correct or delete these values in the `local.properties` files.
117122
118123
### Windows setup for Android (via WSL)
119124

‎libs/android_defaults.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
if [[ -z "${ANDROID_NDK_HOME:-}" || -z "${ANDROID_NDK_ROOT:-}" ]]; then
66
pushd ..
7+
echo "Initializing NDK. Can take a few seconds."
78
NDK_VERSION=$(./gradlew -q printNdkVersion | tail -1)
89
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/$NDK_VERSION"
910
export ANDROID_NDK_ROOT="$ANDROID_NDK_HOME"

0 commit comments

Comments
 (0)