mozilla-mobile

Android components

A collection of Android libraries to build browsers or browser-like applications.
Under Mozilla Public License 2.0
By mozilla-mobile

kotlin android browser components mozilla

Android components


A collection of Android libraries to build browsers or browser-like applications.


ℹ For more information see the website.


A fully-featured reference browser implementation based on the components can be found in the reference-browser repository.


Getting Involved

We encourage you to participate in this open source project. We love pull requests, bug reports, ideas, (security) code reviews or any kind of positive contribution.


Before you attempt to make a contribution please read the Community Participation Guidelines.



Maven repository

All components are getting published on maven.mozilla.org.
To use them, you need to add the following to your project's top-level build file, in the allprojects block (see e.g. the reference-browser):


groovy
repositories {
maven {
url "https://maven.mozilla.org/maven2"
}
}


Each module that uses a component needs to specify it in its build file, in the dependencies block. For example, to use the Base component (in the support) collection, you need:


groovy
dependencies {
implementation 'org.mozilla.components:support-base:+'
}


Nightly builds

Nightly builds are created every day from the main branch and published on nightly.maven.mozilla.org.


Components

Browser

High-level components for building browser(-like) apps.



Concept

API contracts and abstraction layers for browser components.



Feature

Combined components to implement feature-specific use cases.



UI

Generic low-level UI components for building apps.



Service

Components and libraries to interact with backend services.



Support

Supporting components with generic helper code.



Standalone libraries

Tooling

Sample apps

Sample apps using various components.



Building
Command line

$ git clone https://github.com/mozilla-mobile/android-components.git
$ cd android-components
$ ./gradlew assemble


Android Studio

If the environment variable JAVA_HOME is not defined, you will need to set it. If you would like to use the JDK installed by Android Studio, here's how to find it:



  1. Open Android Studio.

  2. Select "Configure".

  3. Select "Default Project Structure". You should now see the Android JDK location.

  4. Set the environment variable JAVA_HOME to the location. (How you set an environment variable depends on your OS.)

  5. Restart Android Studio.


Once the environment variable is set, you can import the project into Android Studio with the default wizard options.


If your build fails, you may find you get more instructive error messages by attempting the build at the command line.


Coding Standards
Style

We follow the style enforced by ktlint and detekt. See how to configure Android Studio appropriately.


To check your style, run:


./gradlew ktlint
./gradlew detekt


Documentation

We use README.md files for each component.


If you fix a bug or change an API, you should update docs/changelog.md.


Testing

You are expected to both add tests for code that you write and make sure that your changes do not
cause existing tests to fail. You may find these command lines helpful:


./gradlew test # Run all tests
./gradlew :support-ktx:testdebugunittest # Run unit tests for a specified module


See also how to measure code coverage.


Accessibility

If your code has user-facing changes, follow Android accessibility best practices.


License
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/