Using the ArcGIS Android SDK with Android Studio – Part 2

In part 1 of this series we discussed how to integrate the ArcGIS Runtime SDK for Android with Android Studio.  The post stepped through the process of manually setting up a single project in Android Studio.  Today, the ArcGIS Android developer team is proud to announce an Early Access Preview (EAP) release of ArcGIS Android Gradle samples.  The samples are open source and can be forked from GithubAndroid Studio development environment is now in Beta and will be the official Android IDE once it’s ready.  We encourage you to collaborate with us working with the new Gradle based Android project structure.  Be aware that this is an EAP and if you are not comfortable using an unfinished product, you may want to use ArcGIS Android Samples in the Eclipse Plugin bundled with the ArcGIS Android SDK.

EAP available on Github

We have two Gradle based repositories on Github:

  1. arcgis-android-api-lib-module
  2. arcgis-android-sdk-gradle-samples

The ArcGIS Android SDK Samples are Gradle based Android projects which can be directly cloned and imported into Android Studio. The ArcGIS Android SDK Samples require the ArcGIS Android API Library Module to be imported into the ArcGIS Android SDK Samples project.

Fork the repo

If you haven’t already, go to https://github.com/ArcGIS/arcgis-android-sdk-gradle-samples and click the Fork button and go to https://github.com/ArcGIS/arcgis-android-api-lib-module and click the Fork button.

Clone the repo

You can directly clone the repo from within Android Studio.

  1. Choose VCS > Checkout from Version Control > GitHub on the main menu.
  2. From the Repository drop-down list, select the source repository to clone the data from.
  3. In the Folder text box, specify the directory where the local repository for cloned sources will be set up.
  4. Click the Clone button to start cloning the sources from the specified remote repository.

Import Gradle Sample project into Android Studio

Once the project is cloned to disk you can import into Android Studio:

  • From the toolbar select File > Import Project
  • Navigate to the root project folder, arcgis-android-sdk-gradle-samples and click OK

Add ArcGIS Android library module

This is where we start to turn our project into an ArcGIS for Android project.

  • Right Click your project and select Open Module Settings
  • Click the + sign above SDK Location and select Import Existing Project then click Next
  • Navigate to the folder where you cloned the arcgis-android-api-lib-module repo and select the arcgis-android-v10.2.3 folder which contains the library module. Do not import the entire project, just the library module e.g. /[path-to-repo]/arcgis-android-api-lib-module/arcgis-android-v10.2.3 and click OK then Finish to import the library module.

NOTE: If you navigate to the root project directory you will see all available modules listed. Ensure thatarcgis-android-v10.2.3 module is select from your project and that the app module is unchecked.

Run a Sample

You should now be able to run any of the included samples. We will use the HelloWorld Sample as an example.

  • Select HelloWorld from the Select Run/Dubug Configuration drop down
  • Click the Run button

Contribute

Anyone and everyone is welcome to contribute. We do accept pull requests.  We welcome all contributions in many ways, e.g.:

  1. Get Involved
  2. Report Issues
  3. Contribute Code
  4. Improve Documentation

Summary

In this post we announced our ArcGIS Android SDK Gradle EAP projects and stepped through the process of getting started.  Android Studio and the Gradle plugin are in BETA and our support is an EAP.

This entry was posted in App Developers, Developer, Mobile and tagged , , , , . Bookmark the permalink.

Leave a Reply

3 Comments

  1. lmuhammad says:

    Great..staying on top of it.

  2. mallikarjun.emani says:

    Links are not proper and i am facing some permission issues. Its really confusing that the ArcGIS Android SDK v2 i download from the ESRI download page is not having the libraries that i am looking for. When tried to setup a project based on the Install and Setup steps of arcgis i am facing some issue that gradle Cant expand the zip file. Its weird and i am stuck at no where.

    • Dan O'Neill says:

      This post is dated. Support for Android Studio and Gradle has come out of EAP status as of v10.2.5. The latest version of the ArcGIS Android SDK is 10.2.6-2. You no longer have to use the download to link the SDK. Please read the latest install and setup for instructions on getting started with the SDK. Please use our forums at GeoNet if you continue to have issues with the SDK.