Using locally-published Glean in Fenix

Note: This is a bit tedious, and you might like to try the substitution-based approach documented in Working on unreleased Glean code in android-components. That approach is still fairly new, and the local-publishing approach in this document is necessary if it fails.

Note: This is Fenix-specific only in that some links on the page go to the mozilla-mobile/fenix repository, however these steps should work for e.g. reference-browser, as well. (Same goes for Lockwise, or any other consumer of Glean, but they may use a different structure -- Lockwise has no Dependencies.kt, for example)


Clone the Glean SDK, android-components and Fenix repositories:

git clone
git clone
git clone

Local publishing

  1. Inside the glean repository root:

    1. In .buildconfig.yml, change libraryVersion to end in -TESTING$N1, where $N is some number that you haven't used for this before.

      Example: libraryVersion: 22.0.0-TESTING1

    2. Check your file, and add rust.targets=x86 if you're testing on the emulator, rust.targets=arm if you're testing on 32-bit arm (arm64 for 64-bit arm, etc). This will make the build that's done in the next step much faster.

    3. Run ./gradlew publishToMavenLocal. This may take a few minutes.

  2. Inside the android-components repository root:

    1. In .buildconfig.yml, change componentsVersion to end in -TESTING$N1, where $N is some number that you haven't used for this before.

      Example: componentsVersion: 24.0.0-TESTING1

    2. Inside buildSrc/src/main/java/Dependencies.kt, change mozilla_glean to reference the libraryVersion you published in step 2 part 1.

      Example: const val mozilla_glean = "22.0.0-TESTING1"

    3. Inside build.gradle, add mavenLocal() inside allprojects { repositories { <here> } }.

    4. Add the following block in the settings.gradle file, before any other statement in the script, in order to have the Glean Gradle plugin loaded from the local Maven repository.

      pluginManagement {
        repositories {
    5. Inside the android-component's file, ensure substitutions.glean.dir is NOT set.

    6. Run ./gradlew publishToMavenLocal.

  3. Inside the fenix repository root:

    1. Inside build.gradle you need to add mavenLocal() twice.
      First add mavenLocal() inside buildscript like this:

      buildscript {
          repositories {

      Second add mavenLocal() inside allprojects:

      allprojects {
          repositories {
    2. Inside buildSrc/src/main/java/AndroidComponents.kt, change VERSION to the version you defined in step 3 part 1.


      const val VERSION = "24.0.0-TESTING1"

You should now be able to build and run Fenix (assuming you could before all this).


  1. This assumes you have followed the Android/Rust build setup
  2. Make sure you're fully up to date in all repositories, unless you know you need to not be.
  3. This omits the steps if changes needed because, e.g. Glean made a breaking change to an API used in android-components. These should be understandable to fix, you usually should be able to find a PR with the fixes somewhere in the android-component's list of pending PRs (or, failing that, a description of what to do in the Glean changelog).
  4. Ask in the #glean channel on


This document is based on the equivalent documentation for application-services: Using locally-published components in Fenix


It doesn't have to end with -TESTING$N, it only needs to have the format -someidentifier. -SNAPSHOT$N is also very common to use, however without the numeric suffix, this has specific meaning to gradle, so we avoid it. Additionally, while the $N we have used in our running example has matched (e.g. all of the identifiers ended in -TESTING1, this is not required, so long as you match everything up correctly at the end).