Skip To Content ArcGIS for Developers Sign In Dashboard


You will learn: how to build an app that loads a basemap and feature layers from a mobile map package file.

The ArcGIS Runtime SDK for Java allows you to provide offline maps to your users so they can be productive when their network connectivity is poor or offline. The mobile map package is a .mmpk file created with another tool, such as ArcGIS Pro, and loaded to your user's device.

Before you begin

Reuse the starter project

If you have not done the starter project tutorial, be sure to review it first so you are familiar with running the app.

In a new or empty folder, make a copy of the Create a starter app solution.

Prepare your data

Complete the tutorial Prepare your data for offline use. You will use the map package file created in that tutorial for the offline map data required in this tutorial.


Update the project

  1. Open the settings.gradle file in an editor of your choice and change the value to add-layers-to-a-map-offline.

Load your map package on to your device

  1. You created a map package in the tutorial Prepare your data for offline use. Add the file to the root of the project. If you did not complete that tutorial, download the map package we prepared.


  1. Open the file src/main/java/com/arcgis/developers/labs/ Add these new import statements:

    import com.esri.arcgisruntime.mapping.MobileMapPackage;
    import com.esri.arcgisruntime.loadable.LoadStatus;

Load and display the map package

  1. Add a new private method setupMobileMap that loads a mmpk file into a map object and then updates the map view to display it. The map package is loaded asynchronously so it does not slow the UI. If the map package fails to load for any reason, we fallback to the online map we had before.

      private void setupMobileMap() {
        if (mapView != null) {
          String mmpkFile = "./offline-maps-package.mmpk";
          final MobileMapPackage mapPackage = new MobileMapPackage(mmpkFile);
          mapPackage.addDoneLoadingListener(() -> {
            if (mapPackage.getLoadStatus() == LoadStatus.LOADED && mapPackage.getMaps().size() > 0) {
            } else {
  2. Look for these lines of the code in the start method


    and replace setupMap() with setupMobileMap():


Congratulations, you're done!

Your map, as it was designed in ArcGIS Pro, should load and display with the view point centered on the Los Angeles area.


Change map contents

Learn how you can change many elements of your map without writing any code. Return to ArcGIS Pro and alter your map: change the extent, add or remove layers, change symbology. Republish your map package and load it on your device.