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

One Comment

  1. lmuhammad says:

    Great..staying on top of it.