Java SDK

Current version: v5.0.0 View changelog

  • Global directions
  • Travel time matrix for multiple points
  • Geocoding
  • Map matching
  • Fastest route between multiple points
  • Static map images
  • Snap traces to road network
  • Geospatial analysis
  • Isochrones

The Mapbox Java SDK is an open source toolset for building applications that need directions, geocoding, static map images, geospatial calculations, and more. It conveniently wraps Mapbox APIs for use in any Java application. This SDK has no dependency on the Android API and can be used in any Java-only project.


To start developing your application using the Mapbox Java SDK, you'll need to first decide which installation method works for you. The SDK is fully compatible with Android using Gradle and most of the project (besides the Android dependent modules) can also be included in a generic Java project using either Gradle or Maven. You can find all dependencies given below on MavenCentral.


  1. Start Android Studio
  2. Open up your applications build.gradle
  3. Make sure your projects minSdkVersion is at API 14 or higher
  4. Under dependencies add a new build rule for the latest mapbox-android-services
  5. Click the Sync Project with Gradle Files near the toolbar in Studio

If your application is close or exceeds the 65k method count limit, you can mitigate this problem by specifying only the specific Mapbox Android Service APIs. See the selectively compiling APIs section below.

/* Replace `DESIRED_JAVA_SDK_PACKAGE` with the name of one of the packages listed in the next section */
implementation 'com.mapbox.mapboxsdk:DESIRED_JAVA_SDK_PACKAGE:5.0.0'


If your project's using Maven instead of Gradle, you can add the dependency inside your projects POM.xml file.

    <!-- Replace `DESIRED_JAVA_SDK_PACKAGE` with the name of one of the packages listed in the next section-->

Available packages

Here are the current Java SDK dependencies, which you can use in your Android/Java project.

GeoJSON – Java classes which model the GeoJSON spec.

implementation 'com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.0.0'

Services – Convenient wrappers to interact with Mapbox APIs: Matrix, Geocoder, Tilequery, Optimization, Static Image, Map Matching, and Isochrone.

implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.0.0'

Turf for Java - Runtime on-device geospatial calculations.

implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.0.0'

Core - Color, text, and networking utility classes.

implementation 'com.mapbox.mapboxsdk:mapbox-sdk-core:5.0.0'

Access tokens

You'll need to have a Mapbox access token if you plan to use any of the mapbox-sdk-services wrappers around Mapbox APIs. An access token is not needed if you plan to use the Mapbox Java SDK's GeoJSON library, Turf library, or certain parts of its Core library. Learn more about how access tokens work.

Point object

The Java SDK uses the Point object to represent a geographical coordinate. Point objects contain two values, longitude and latitude, in that order. This order is the reverse of the LatLng object in the Mapbox Maps SDK for Android. If you are using the Maps SDK and the Java SDK together, you will need to convert between Point and LatLng objects.

Point point = Point.fromLngLat(LONGITUDE, LATITUDE);

Support and contributions

Was this page helpful?