Note: The Android SDK, Android Studio, and certain other development tools are provided by third parties, not by Amazon. Our links for these tools take you to third-party sites for downloading and installing the tools.

If you are developing for Fire phone, configure the Android SDK Manager with the Amazon SDK Add-On (see Setting Up Your Development Environment for Fire Phone). The Amazon Maps API v2 is available in the SDK Manager under Extras. Once installed, the sample is in the <Android SDK Folder>\extras\amazon\mapsv2\samples\CapitolHillCoffee folder:

Note: When using this method, you only need to configure the SDK Manager and then download the Maps API v2 from extras. You do not need to install the Fire Phone SDK, Fire Tablet SDK, or Fire Phone Build Tools to use the Maps v2 API.

There are four separate projects in the CapitolHillCoffee folder, illustrating the CapitolHillCoffee app at different stages:

CoffeeActivityDisplay

CoffeeActivityLocation

CoffeeActivityMarkers

CoffeeActivityFinal

Importing the Sample Code

You can import the sample projects into an IDE such as Android Studio.

Importing the Sample Code into Android Studio

When using Android Studio, use the Import Non-Android Studio project from the Welcome screen (called Import Project in pre-1.0 versions). By default, this copies the project to your default location for Android projects.

This also imports the project's dependencies, but we recommend updating your project to reference the Amazon Maps API Support Library in a local Maven repository instead:

Install the support library to a local Maven repository if not already done.

Update the sample project dependencies to use the Maven reference.

In the module-level build.gradle file, under the dependencies section, delete the following line:

compile project(':amazonmapsapiv2_lib')

This line is added by the import operation.

In File Explorer, navigate to your Android Studio project and delete the amazonmapsapiv2_lib directory. This is the version of the support library that was copied into your project during the import operation.

At the top of the editor, in the yellow alert indicating that Gradle files have changed, click Sync Now.

Compiling and Running the Sample

Before you can run the sample, you need to register it with the Amazon Apps & Games Developer Portal. This provides the app access to map tiles.

The package name for the sample is com.example.amazon.capitolhillcoffee. You should change this to your own package name before registering the app. Be sure to update the package name in all the places it appears in the project: