Navigation SDK is currently available only to select customers. Contact sales to learn more.

Set up your project

Stay organized with collections Save and categorize content based on your preferences.

This guide lists the build configuration requirements for using the Navigation SDK for Android. The instructions assume you have an Android IDE installed and are familiar with Android development.

Minimum requirements for using Navigation SDK

  • A Google Cloud Console project with the Navigation SDK enabled. For provisioning, ask your Google Maps Platform representative.

  • Your app must target API level 30 or higher.

  • To run an app built with the Navigation SDK, the Android device must have Google Play services installed and enabled.

  • Attributions and licensing text must be added to the app.

Set up your projects: Cloud Console project and Android project

Before you can build or test an app, you need to create a Cloud Console project and add API key credentials. The project must have provisioning to access the Navigation SDK. All keys within the Cloud Console project are granted the same access to the Navigation SDK. A key can have more than one development project associated with it. If you already have a console project, you can add a key to your current project.

To set up

  1. In your favorite web browser, such as Chrome, sign in to the Cloud Console and create your Cloud Console project.
  2. In your IDE, such as Android Studio, create an Android app development project and note the package name.
  3. Contact your Google Maps Platform representative to provide access to the Navigation SDK for your Cloud Console project.
  4. While on the Cloud Console dashboard in your web browser, create credentials to generate an API key with restrictions.
  5. On the API key page, click Android apps in the *Application restrictions area.
  6. Click Add the package name and fingerprint, and then, enter the package name of your development project and the SHA-1 fingerprint for that key.
  7. Click Save.

Add the Navigation SDK to your project

The Navigation SDK is available as an aar bundle. After you create your development project, you can integrate the SDK into it by using one of the following two approaches.

  1. Set up your environment to access the host Maven repository as described in Android SDK Setup.
  2. Add the following dependency to your Gradle or Maven configuration, substituting the VERSION_NUMBER placeholder for the desired version of Navigation SDK.


    Add the following to your app-level build.gradle:

    dependencies {
      implementation '[VERSION_NUMBER]'

    And add the following to your project-level build.gradle:

    allprojects {
       // Required: you must exclude the Google Play service Maps SDK from
       // your transitive dependencies. This is to ensure there won't be
       // multiple copies of Google Maps SDK in your binary, as the Navigation
       // SDK already bundles the Google Maps SDK.
       configurations {
           implementation {
               exclude group: '', module: 'play-services-maps'


    Add the following to your pom.xml:


    If you have any dependencies that use the Maps SDK, you'll have to exclude the dependency in each declared depencency that relies on the Maps SDK. <dependencies> <dependency> <groupId></groupId> <artifactId>MapsConsumer</artifactId> <version>1.0</version> <exclusions> <!-- Navigation SDK already bundles Maps SDK. You must exclude it to prevent duplication--> <exclusion> <!-- declare the exclusion here --> <groupId></groupId> <artifactId>play-services-maps</artifactId> </exclusion> </exclusions> </dependency> </dependencies>

Using a downloaded AAR bundle

The Navigation SDK is also available as an aar bundle. After creating the development project, you can integrate the SDK. These instructions assume the use of Android Studio for your IDE.

  1. Download and unzip the Navigation SDK zip file.

  2. In Android Studio, open a project and [add the Google Play services package] [play-services-install] using the SDK manager.

  3. From the zip file directory, copy libs/google_navigation.aar into your project's app/libs directory.

Configure the build

After you have created the project, you can configure the settings for a successful build and use of the Navigation SDK.

Update local properties

  • In the Gradle Scripts folder, open the file and add android.useDeprecatedNdk=true.

Update the Gradle build script

  • Open the build.gradle (Module:app) file and use the following guidelines to update the settings to meet the requirements for Navigation SDK and consider setting the optimization options as well.

    Required settings for Navigation SDK

    1. Set minSdkVersion to 23 or above.
    2. Set targetSdkversion for API 30 or above.
    3. Add a dexOptions setting that increases the javaMaxHeapSize.
    4. Set the location for additional libraries.
    5. Add the repositories and dependencies for the Navigation SDK.
    6. Replace the version numbers in the dependencies with the latest available versions.

    Optional settings to decrease build time

    • To improve the build time for your app
    • Optimize use of the dependencies. Enable ProGuard and resource shrinking. Proguard removes unused code and resources from dependencies. If the proguard step runs too long, consider enabling multidex for development work.
    • Reduce the number of language translations included in the build: Set resConfigs for one language during development. For the final build, set 'resConfigs' for languages you actually use. By default, Gradle includes resource strings for all languages supported by the Navigation SDK.

Below is an example of the Gradle build script for the application. Check the sample apps for updated sets of dependencies, as the version of Navigation SDK you are using may be slightly ahead or behind this documentation.

  apply plugin: ''

  ext {
      androidxVersion = "1.0.0"
      lifecycle_version = "1.1.1"

  android {
      compileSdkVersion 30
      buildToolsVersion '28.0.3'

      defaultConfig {
          applicationId "<your id>"
          // Navigation API supports SDK 23 and later.
          minSdkVersion 23
          targetSdkVersion 30
          versionCode 1
          versionName "1.0"
          // Set this to the languages you actually use, otherwise you'll include resource strings
          // for all languages supported by Navigation API.
          resConfigs "en"
          multiDexEnabled true

      dexOptions {
          // This increases the amount of memory available to the dexer. This is required to build
          // apps using the Navigation API.
          javaMaxHeapSize "4g"
      buildTypes {
          // Run proguard. Note that the Navigation API includes its own proguard config, which
          // will be included transitively by depending on the Navigation API.
          // If the proguard step takes too long, consider enabling multidex for development work
          // instead.
          all {
              minifyEnabled true
              proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8

  // This tells gradle where to look to find additional libraries - in this case, the
  // google_navigation.aar file.
  repositories {
      flatDir {
          dirs 'libs'

  dependencies {
      api fileTree(include: ['*.jar'], dir: 'libs')

      // Include the Google Navigation API library
      api(name: 'google_navigation', ext: 'aar')

      // These dependencies are required for the Navigation API to function
      // properly at runtime.
      api ""
      // Optional for Cronet users:
      // api ""
      api "androidx.appcompat:appcompat:${androidxVersion}"
      api "androidx.cardview:cardview:${androidxVersion}"
      api "${androidxVersion}"
      api "androidx.mediarouter:mediarouter:${androidxVersion}"
      api "androidx.preference:preference:${androidxVersion}"
      api "androidx.recyclerview:recyclerview:${androidxVersion}"
      api "androidx.legacy:legacy-support-v4:${androidxVersion}"
      api 'com.github.bumptech.glide:glide:4.9.0'
      api 'com.github.bumptech.glide:okhttp-integration:4.9.0'
      api "android.arch.lifecycle:common-java8:$lifecycle_version"
      api ''
      api ''
      api ''
      api ''
      api 'joda-time:joda-time:2.9.9'
      annotationProcessor 'androidx.annotation:annotation:1.1.0'
      annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

Add the API key to your app

This section describes how to store your API key so that it can be securely referenced by your app. You should not check your API key into your version control system, so we recommend storing it in the file, which is located in the root directory of your project. For more information about the file, see Gradle properties files.

To streamline this task, we recommend that you use the Secrets Gradle Plugin for Android. To install the plugin and store your API key:

  1. In Android Studio, open your project-level build.gradle file and add the following code to the dependencies element under buildscript.
    plugins {
        // ...
        id '' version '2.0.1' apply false
  2. Next, open your module-level build.gradle file and add the following code to the plugins element.
    id ''
  3. Save the file and sync your project with Gradle.
  4. Open the in your project level directory, and then add the following code. Replace YOUR_API_KEY with your API key.
  5. Save the file.
  6. In your AndroidManifest.xml file, go to and update the android:value attribute as follows:
        android:value="${MAPS_API_KEY}" />

Note: As shown above, is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Navigation SDK for Android. For backwards compatibility, the API also supports the name This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception.

Include the required attributions in your app

If you use the Navigation SDK for Android in your app, you must include attribution text and open source licenses as part of your app's legal notices section.

You can find the required attribution text and open source licenses in the Navigation SDK for Android zip file:

  • NOTICE.txt
  • LICENSES.txt