Skip to content
Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
Java Kotlin HTML JavaScript Makefile Python
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci [build] add CI job with building with buck (#26) Oct 29, 2019
MapboxGLAndroidSDK [libaryloader] synchronise access to the library loader load method (#58 Nov 18, 2019
MapboxGLAndroidSDKLint [build] - initial commit Oct 9, 2019
MapboxGLAndroidSDKTestApp add collection and style smooth reload example Nov 13, 2019
gradle Update soLoader to version 0.8.0. (#23) Oct 24, 2019
resources [build] - initial commit Oct 9, 2019
scripts skip jni layers generation Nov 13, 2019
vendor bump gl-native submodule and bring platform changes Nov 13, 2019
.editorconfig [build] - initial commit Oct 9, 2019
.gitignore [build] add continous integration Oct 14, 2019
.gitmodules [build] use https for git submodules (#57) Nov 15, 2019
CHANGELOG.md [libaryloader] synchronise access to the library loader load method (#58 Nov 18, 2019
DISTRIBUTE.md [build] - initial commit Oct 9, 2019
LICENSE.md [build] - initial commit Oct 9, 2019
Makefile
README.md Adjusting CircleCI README badge to this repo (#30) Oct 29, 2019
TESTS.md [build] - initial commit Oct 9, 2019
build.gradle [build] - initial commit Oct 9, 2019
checkstyle.xml [build] - initial commit Oct 9, 2019
gradlew [build] - initial commit Oct 9, 2019
gradlew.bat [build] - initial commit Oct 9, 2019
package-lock.json Bump esm from 3.0.84 to 3.1.0 Oct 15, 2019
package.json Bump esm from 3.0.84 to 3.1.0 Oct 15, 2019
settings.gradle [build] - initial commit Oct 9, 2019

README.md

Mapbox Maps SDK for Android

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

These dependencies are required for all operating systems and all platform targets.

  • Latest stable Android Studio
  • Update the Mapbox Maps SDK for Android with the latest
    • Android SDK Build-Tools
    • Android Platform-Tools
    • Android SDK Tools
    • CMake
    • NDK
    • LLDB
  • Modern C++ compiler that supports -std=c++14*
    • clang++ 3.5 or later or
    • g++-4.9 or later
  • Node.js
    • make sure npm is installed as well
  • ccache (optional)

Note: We partially support C++14 because GCC 4.9 does not fully implement the final draft of the C++14 standard. More information in DEVELOPING.md.

Note: On macOS you can install clang with installing the Apple command line developer tools.

Opening the project

macOS

Execute the following command in this repository's root folder to generate the required build files and open the project with Android Studio:

make aproj

linux

run make android-configuration in the root folder of the project and open in Android Studio.

If you are using Arch Linux, install ncurses5-compat-libs.

Project configuration

Setup Checkstyle

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

Resolving duplicate file entries

With buck build support, Android Studio can complain about duplicate source files. To remove this warning, open MapboxGLAndroidSDK.iml find the list of excludeFolder entries and add <excludeFolder url="file://$MODULE_DIR$/../../../misc/" /> line.

Setting Mapbox Access Token

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.

Running project

Run the configuration for the MapboxGLAndroidSDKTestApp module and select a device or emulator to deploy on. Based on the selected device, the c++ code will be compiled for the related processor architecture. You can see the project compiling in the View > Tool Windows > Gradle Console.

More information about building and distributing this project in DISTRIBUTE.md.

Additional resources

Using the SDK snapshot

Instead of using the latest stable release of the Maps SDK for Android, you can use a "snapshot" or the beta version if there is one available. Our snapshots are built every time a Github pull request adds code to this repository's master branch. If you'd like to use a snapshot build, your Android project's gradle file should have -SNAPSHOT appended to the SDK version number. For example, the 7.3.0-SNAPSHOT would look like:

// Mapbox SDK dependency
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.5.0-SNAPSHOT'

You also need to have the section below in your build.gradle root folder to be able to resolve the SNAPSHOT dependencies:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
    }
}

Symbolicating native crashes

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

You can’t perform that action at this time.