Select platform: [Android](https://developers.google.com/maps/documentation/android-sdk/examples.md.txt "View this page for the Android platform docs.") [iOS](https://developers.google.com/maps/documentation/ios-sdk/examples.md.txt "View this page for the iOS platform docs.") [JavaScript](https://developers.google.com/maps/documentation/javascript/examples.md.txt "View this page for the JavaScript platform docs.")

<br />

The Maps SDK for Android repository on [GitHub](https://github.com/googlemaps-samples/android-samples)
includes samples illustrating the use of the Maps SDK for Android in
your Android app.

The repository contains the [ApiDemos](https://github.com/googlemaps-samples/android-samples/tree/main/ApiDemos) app, a sample app that lets
you build and run the samples from a single Android app. Import and build the
app, add your API key, view the demo, and use the sample code supplied as a
starting point for your app.

When you run the sample app, it displays a list of available samples that you
can run on your own device. Select one of the options. For example, click
**Basic Map**.

**Troubleshooting:** If the sample app runs successfully but you don't see a
map, check that you've added your API key to the app's manifest file, as
described in [Using API Keys](https://developers.google.com/maps/documentation/android-sdk/get-api-key.md.txt).

## Maps SDK for Android sample app list

Key sample activities contained in the Maps SDK for Android
[ApiDemos](https://github.com/googlemaps-samples/android-samples/tree/main/ApiDemos) app are listed below and reproduced at the linked pages
for quick reference. See the [Kotlin](https://github.com/googlemaps-samples/android-samples/tree/main/ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos) or [Java](https://github.com/googlemaps-samples/android-samples/tree/main/ApiDemos/java/app/src/main/java/com/example/mapdemo)
folder for the full list of available samples.

- [Basic map](https://developers.google.com/maps/documentation/android-sdk/examples/basic-map.md.txt)
- [Markers](https://developers.google.com/maps/documentation/android-sdk/examples/marker.md.txt)
- [Advanced markers](https://developers.google.com/maps/documentation/android-sdk/examples/advanced-marker.md.txt)
- [My Location](https://developers.google.com/maps/documentation/android-sdk/examples/my-location.md.txt)
- [Events](https://developers.google.com/maps/documentation/android-sdk/examples/events.md.txt)
- [Polylines](https://developers.google.com/maps/documentation/android-sdk/examples/polyline.md.txt)
- [Polygons](https://developers.google.com/maps/documentation/android-sdk/examples/polygon.md.txt)

## Clone and run the samples

Git is required to run this sample locally. The following command clones the sample
application repository.

```
git clone git@github.com:googlemaps-samples/android-samples.git
```

Import the sample project into Android Studio:

1. In Android Studio, select **File \> New \> Import Project**.
2. Go to the location where you saved the repository and select the project directory for
   Kotlin or Java:

   - **Kotlin** : `PATH-REPO/android-samples/ApiDemos/kotlin`
   - **Java** : `PATH-REPO/android-samples/ApiDemos/java`
3. Select **Open**. Android Studio builds your project, using the Gradle build tool.
4. Create a blank `secrets.properties` file in the same directory as your project's `local.properties` file. For more information about this file, see [Add your API key to the project](https://developers.google.com/maps/documentation/android-sdk/config.md.txt#step_3_add_your_api_key_to_the_project).
5. [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key.md.txt) from your project with the [Maps SDK for Android enabled](https://developers.google.com/maps/documentation/android-sdk/cloud-setup#enabling-apis).
6. Add the following string to `secrets.properties`, replacing **YOUR_API_KEY** with the value of
   your API key:

   ```
   MAPS_API_KEY=YOUR_API_KEY
   ```
7. Run the app.

## Sample app for maps on Wear OS

A sample app for Maps SDK for Android on Wear OS is
available on [GitHub](https://github.com/googlemaps-samples/android-samples/tree/main/WearOS), which you can use as a starting point when
building a wearable app. The sample shows you how to set up a basic Google Map
on Wear OS.