Home

Awesome

Mapbox Maps SDK for Android

The latest version of Mapbox Maps SDK is now available at mapbox/mapbox-maps-android. This version offers superior performance, features, and developer experience, and is the recommended mobile SDK solution for all Mapbox customers.

Mapbox maintains this repo to address bug fixes and security vulnerabilities. Please note that this project will cease to receive updates, including compatibility and bugfixes, after April 4, 2023. Here is a helpful guide about our latest SDK features and how to migrate to our latest version.

Circle CI build status

The Mapbox Maps SDK for Android is a library based on Mapbox GL Native for embedding interactive map views with scalable, customizable vector maps onto Android devices.

Getting Started

This particular README is for people who are interested in working on and improving the Maps SDK for Android. If you're looking for more general information and instructions on the Maps SDK:

Visit https://docs.mapbox.com/android/maps/overview to see current documentation on the Maps SDK for Android.

Visit https://docs.mapbox.com/android/api/map-sdk to view the Maps SDK's current API reference Javadoc files.

See the Mapbox website's Android install flow to install and use the Mapbox Maps SDK for Android in an application.

Setup environment

These instructions are for developers interested in making code-level contributions to the SDK itself. If you instead want to use the SDK in your app, see above.

Getting the source

Clone the git repository and pull in submodules:

git clone git@github.com:mapbox/mapbox-gl-native-android.git && cd mapbox-gl-native-android
git submodule update --init --recursive

Installing dependencies

Opening the project

Open the root folder of this repository in Android Studio.

Project configuration

Setup Mapbox Access token for dependency download

Add a Mapbox access token with scope set to DOWNLOADS:READ in the root build.gradle.

allprojects {
    repositories {
        maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username = "mapbox"
                password = "INSERT_MAPBOX_ACCESS_TOKEN_HERE"
            }
        }
    }
}

Setup Checkstyle

Mapbox uses specific IDE settings related to code and check style. See checkstyle guide for configuration details.

Setup Mapbox Access Token for Mapbox vector tiles

The test application (used for development purposes) uses Mapbox vector tiles, which require a Mapbox account and API access token. Obtain a free access token on the Mapbox account page.

With the first gradle invocation, gradle will take the value of the MAPBOX_ACCESS_TOKEN environment variable and save it to MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml. If the environment variable wasn't set, you can edit developer-config.xml manually and add your access token to the mapbox_access_token resource.

Additional resources

Symbolicating native crashes

When hitting native crashes you can use ndk-stack to symbolicate crashes. More information in this guide.