Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Android

Android Sample Code Home

How to work with the samples

The ArcGIS Runtime SDK for Android samples are tools for developers to understand and implement the fundamentals of the ArcGIS Android API and its coding practices.

This document describes how to access the samples and how to import them into your development environment and run them.

Where to find the samples

The ArcGIS Android SDK samples are now hosted on GitHub!

Getting started with GitHub

GitHub is a web based hosting service for software development projects that uses an open source revision control system called Git. See Git Basics for an introduction to Git and how it compares with other version control systems. Visit GitHub to learn how to interact with Git repositories with GitHub and to sign up for a free account.

Access the samples

  1. If you don't already have an account, Sign up for GitHub!
  2. If you're new to GitHub, you may want to review some common help topics to get started.
  3. Visit the arcgis-runtime-samples-android repository.
  4. Follow the instructions in the repo's README file to work with the sample projects in Android Studio.

Local SDK

If you cannot access the samples on GitHub, the samples provided in the local SDK download have an archive with samples available at the time of the release. These can be found in the /samples folder. They are an archive snapshot of the GitHub repository available at the time of the release. To use these samples you will need to download them and then Importing-samples-from-disk.

Importing samples from disk

A snapshot of the samples are provided with the SDK download in the /samples folder. Open this archive to a directory on disk. Use that directory as the root for your Android Studio project.

Using Android Studio

  1. Select File > Import Project, or Import Non-Android Studio project from the Welcome Quick Start.
  2. Navigate to the root of the arcgis-runtime-samples-android-10.2.9 directory and click OK

Gradle will do an initial build and download any dependencies not in your maven local cache. Once compete you are ready to [Run the samples](#Running samples).

Running samples

ArcGIS Android SDK samples are in Android Gradle project structure, the default Android project structure for Android Studio.

Android Studio

Once you have successfully imported the project into Android Studio your project structure should look like the following:

Android sample project structure

To run a sample, choose the sample you wish to run from the Run/Debug Configuration list and click the Run button. The screenshot below shows the list of available samples with Basemaps selected. Clicking the Run button next to the drop down will run the Basemaps sample.

Android sample modules

Using a physical Android device

You can develop and test your sample application directly on a physical device connected to your machine through a USB connection. See the specific section in Android's developer guide for developing on a physical device. Identical to the AVD, once the physical device is set up, the same instructions can be followed for deploying your applications to a phone.

Please refer to the following document for information about setting up the Android Emulator.

Feedback on this topic?