Skip to content

Developer Instructions

Shubham Sharma edited this page Apr 18, 2023 · 5 revisions

The ArcGIS Maps SDK for Kotlin Samples are Gradle based Android projects which can be directly cloned and imported into Android Studio.

Fork the repo

If you haven't already, fork the this repo.

Clone the repo

Once you have forked the repo, you need to create a local copy, or clone. You can do this directly in Android Studio, from a terminal prompt, or a GUI Client.

Android Studio

Clone the ArcGIS Maps SDK for Kotlin Samples in 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.

Command line Git

Clone the ArcGIS Maps SDK for Kotlin Samples

Open your terminal, navigate to your working directory, use git clone to get a copy of the repo.

# Clones your fork of the repository into the current directory in terminal
$ git clone https://github.com/YOUR-USERNAME/arcgis-maps-sdk-kotlin-samples.git

Configure remote upstream for your fork

To sync changes you make in a fork with this repository, you must configure a remote that points to the upstream repository in Git.

  • Open a terminal or command prompt
  • List the current configured remote repository for your fork
$ git remote -v
origin  https://github.com/YOUR_USERNAME/arcgis-maps-sdk-kotlin-samples.git (fetch)
origin  https://github.com/YOUR_USERNAME/arcgis-maps-sdk-kotlin-samples.git (push)
  • Specify a new remote upstream repository
$ git remote add upstream https://github.com/Esri/arcgis-maps-sdk-kotlin-samples.git
  • Verify the new upstream repository
$ git remote -v
origin  https://github.com/YOUR_USERNAME/arcgis-maps-sdk-kotlin-samples.git (fetch)
origin  https://github.com/YOUR_USERNAME/arcgis-maps-sdk-kotlin-samples.git (push)
upstream https://github.com/Esri/arcgis-maps-sdk-kotlin-samples.git (fetch)
upstream https://github.com/Esri/arcgis-maps-sdk-kotlin-samples.git (push)

Sync your fork

Once you have set up a remote upstream you can keep your fork up to date with our samples repository by syncing your fork.

  • Open a terminal or command prompt
  • Change to the current working directory of your local repository
  • Fetch the branches and commits from the upstream repository. Commits to main will be stored in a local branch, upstream/main.
$ git fetch upstream
  • Check out your forks local main branch
$ git checkout main
  • Merge changes from upstream/main into your local main branch which syncs your forks main branch with our samples repository.
$ git merge upstream/main

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, or Import Non-Android Studio project from the Welcome Quick Start.
  • Navigate to arcgis-maps-sdk-kotlin-samples/ directory and click OK

ArcGIS Maps SDK dependency

The latest ArcGIS Maps SDK compile dependency is defined for all sample modules in the root project build.gradle. This is the only place where you need to define the dependency to the ArcGIS Maps SDK for Kotlin.

subprojects {
    afterEvaluate { project ->
        if (project.hasProperty("dependencies")) {
            dependencies {
                compile 'com.esri:arcgis-maps-kotlin:200.1.0'
            }
        }
    }
}

Our SDK is hosted in our public maven repository hosted by JFrog. Our repository url is added to the projects root build.gradle file.

repositories {
    mavenCentral()
    maven {
        url 'https://esri.jfrog.io/artifactory/arcgis'
    }
}

Run a sample

You should now be able to run any of the included samples. We will use the display-map sample as an example.

  • Select display-map from the Select Run/Debug Configuration drop down
  • Click the Run button

Troubleshooting

  • Q: Gradle complains about SdkPlatformNotFoundException?
    • A: Check if your Android SDK version is the same as in the prerequisites section.
  • Q: Unable to find System Image in Emulator in Android Studio with Google APIs?
    • A: Please download the simulator in AVD Manager.

Wiki Home