Mobile/Fennec/Android/Build Systems

From MozillaWiki
< Mobile‎ | Fennec‎ | Android
Jump to: navigation, search

Fennec on Android currently has two parallel build systems: front end code can be built using |mach| or using gradle.

If you only want to build Fennec: you should read . This wiki page is intended to describe the build systems in more detail.

Our builds are complicated because we combine Java, C++ and Javascript all into one app (the latter two are because we share the Gecko rendering engine with the desktop version of Firefox). A brief overview of what various parts of the codebase are responsible for can be found in App Structure.


Gradle based builds are intended to replace the mach based builds. Currently releases are built using mach, gradle is experimental but is useful for frontend development, including when using Android Studio / IntelliJ. Both types of builds are now run in automation.

Important note: new classes have to manually be added to, or a |mach build| is likely to fail. Any build / library changes need to be currently be made in both mach and gradle.


  • Homegrown mozilla Makefile (ish) based system
  • We have our own invocations of all the build tools, including javac, dex, aapt
  • Mobile specific mach build code lives in:
    • mobile/android/base/
    • and partially in mobile/android/base/

Most of firefox is in fact build using mach, however we want to avoid using mach to build java code, and the apk.

Output apks from mach builds will end up in:



  • Standardised android build system
  • Gecko (i.e. c++ code) is still built using mach, gradle only builds the frontend / Java app.
  • Is used by default in IDE builds (Android Studio / IntelliJ).
  • Primarily lives in mobile/android/app/build.gradle for Fennec specific config
    • Some further build.gradle files exist for the overall project build, and specific components / libraries.

Output apks from gradle builds will end up in:


See mobile/android/app/build.gradle for details on the build variants, the ones you maybe interested in are:

  • Debug builds with multi-dex: app-local-debug.apk
  • Debug builds with single-dex: app-localOld-debug.apk

[ Need Update ] See :

Full gradle builds

The standard method of doing a frontend build currently is running

 mach build && mach package && mach gradle build

This follows the normal mach based process, and then starts a gradle based build which takes the (mach build) gecko libraries as an input.

In future we want to be able to avoid using mach for the android part of the process. These builds are experimental, and can be run by adding the following to your mozconfig:

 ac_add_options --with-gradle

You can now run |mach build|, followed by |mach package|, which will produce apk's in the same location as a mach build.

TODO: add explanation of what actually happens in practice?

Note that these builds do not interact with the usual gradle builds, see the following email for more information:


TODO: describe how tests are built...