MapLibre Android Developer Guide

These instructions are for developers interested in making code-level contributions to MapLibre Native for Android.

Getting the source

Clone the git repository and pull in submodules:

git clone git@github.com:maplibre/maplibre-native.git
cd maplibre-native
git submodule update --init --recursive
cd platform/android

Requirements

Android Studio needs to be installed.

Open the platform/android directory to get started.

Setting an API Key

The test application (used for development purposes) uses MapTiler vector tiles, which require a MapTiler account and API key.

With the first Gradle invocation, Gradle will take the value of the MLN_API_KEY environment variable and save it to MapLibreAndroidTestApp/src/main/res/values/developer-config.xml. If the environment variable wasn't set, you can edit developer-config.xml manually and add your API key to the api_key resource.

Running the TestApp

Run the configuration for the MapLibreAndroidTestApp module and select a device or emulator to deploy on.

Android TestApp menu Android TestApp showing Demotiles

Kotlin

All new code should be written in Kotlin.

Style Checking

To check Kotlin style, we use ktlint. This linter is based on the official Kotlin coding conventions. We intergrate with it using the kotlinder Gradle plugin.

To check the style of all Kotlin source files, use:

$ ./gradlew checkStyle

To format all Kotlin source files, use:

$ ./gradlew formatKotlin

Profiling

See Tracy Profiling to understand how Tracy can be used for profiling.