Getting Started with GeckoView

How to use GeckoView in your Android app. Building a browser? Check out Android Components, our collection of ready-to-use support libraries!

The following article is a brief guide to embedding GeckoView in an app. For a more in depth tutorial on getting started with GeckoView please read the article we have published on

Table of contents

{: .no_toc .text-delta }

  1. TOC {:toc}

Configure Gradle

You need to add or edit four stanzas inside your module’s build.gradle file.

1. Set the GeckoView version

Like Firefox, GeckoView has three release channels: Stable, Beta, and Nightly. Browse the Maven Repository to see currently available builds.

ext {
    geckoviewChannel = "nightly"
    geckoviewVersion = "70.0.20190712095934"

2. Add Mozilla’s Maven repository

repositories {
    maven {
        url ""

3. Java 8 required support

As GeckoView uses some Java 8 APIs, it requires these compatibility flags:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

4. Add GeckoView Implementations

dependencies {
    // ...
  implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"   

Add GeckoView to a Layout

Inside a layout .xml file, add the following:

    android:layout_height="fill_parent" />

Initialize GeckoView in an Activity

1. Import the GeckoView classes inside an Activity:

import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;

2. In that activity’s onCreate function, add the following:

GeckoView view = findViewById(;
GeckoSession session = new GeckoSession();
GeckoRuntime runtime = GeckoRuntime.create(this);;
session.loadUri("about:buildconfig"); // Or any other URL...

You’re done!

Your application should now load and display a webpage inside of GeckoView.

To learn more about GeckoView’s capabilities, review GeckoView’s JavaDoc or the reference application.