[null,null,["最終更新日 2025-08-17 UTC。"],[[["\u003cp\u003eThis guide outlines the process of setting up and configuring a Google Cloud console project to utilize the Driver SDK for Android in your application.\u003c/p\u003e\n"],["\u003cp\u003eIt involves adding the Driver SDK and Navigation SDK dependencies, integrating your API key securely, and including necessary attributions within your app.\u003c/p\u003e\n"],["\u003cp\u003eYou must enable the Maps SDK for Android in your Google Cloud project, and your application should target a minimum SDK version of 23 or higher.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal navigation, ensure the driver grants both fine and coarse location permissions during runtime.\u003c/p\u003e\n"]]],["To configure a project for the Driver SDK, first, set up a Google Cloud project and enable the Maps SDK for Android. Next, add the Driver SDK and Navigation SDK dependencies to your project's Gradle or Maven configuration, ensuring you define an explicit Navigation SDK version. Then, securely store your API key in the `local.properties` file, utilizing the Secrets Gradle Plugin, and reference it in `AndroidManifest.xml`. Finally, include required attributions in your app's legal notices section.\n"],null,["To set up and configure a Google Cloud console project to use the Driver SDK for\nAndroid, follow these steps.\n\n1. [Set up your mobile app project](#auth-project).\n2. [Add the Driver SDK to your app](#add-sdk).\n3. [Add the API key to your app](#add-key).\n4. [Include the required attributions in your app](#include-attributions).\n\nFor more details on each step, see the following sections.\n| **Note:** Your app must target `minSdkVersion` 23 or higher.\n\nSet up your mobile app project\n\nThis section describes how to configure your mobile app project for the Driver\nSDK.\n\nTo configure your mobile app project, follow these steps:\n\n1. If you don't have a Google Cloud console development project and an API key for your mobility project, you need to set one up. For more information, see [Create your Fleet Engine project](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/create-project).\n2. In the Google Cloud console, select the same Google Cloud console project and API key that you are using for Fleet Engine.\n3. Select **APIs \\& Services** and search for and enable the Maps SDK for Android.\n\nAdd the Driver SDK to your app\n\nThe Driver SDK is available from the Google Maven repository. The repository\nincludes the SDK's Project Object Model (.pom) files and Javadocs.\n\nTo add the Driver SDK to your app, add the Driver SDK and Navigation SDK\ndependencies to your Gradle or Maven configuration.\n| **Note:** The Driver SDK depends on the Navigation SDK. Set your dependency to an **explicitly defined** version of the Navigation SDK, as shown in this example. Otherwise, omit the example code block to enable the project to always download the latest version of the Navigation SDK within the major release version. The combined behaviors of the latest versions of Driver SDK and Navigation SDK have underwent rigorous testing before their releases.\n\nIn the following example, substitute `VERSION_NUMBER` with the selected version\nof the Driver SDK. \n\nGradle\n\nAdd the following to your `build.gradle`: \n\n dependencies {\n ...\n implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:\u003cvar translate=\"no\"\u003eVERSION_NUMBER\u003c/var\u003e'\n implementation 'com.google.android.libraries.navigation:navigation:5.0.0'\n }\n\nMaven\n\nAdd the following to your `pom.xml`: \n\n \u003cdependencies\u003e\n ...\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.android.libraries.mapsplatform.transportation.driver\u003c/groupId\u003e\n \u003cartifactId\u003etransportation-driver\u003c/artifactId\u003e\n \u003cversion\u003e\u003cvar translate=\"no\"\u003eVERSION_NUMBER\u003c/var\u003e\u003c/version\u003e\n \u003c/dependency\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.android.libraries.navigation\u003c/groupId\u003e\n \u003cartifactId\u003enavigation\u003c/artifactId\u003e\n \u003cversion\u003e5.0.0\u003c/version\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n\nAdd the API key to your app\n\nOnce you have added the Driver SDK to your app, add the API key. You must use\nthe project API key you obtained when you set up your development project. For\nmore details, see [Set up your mobile app project](#auth-project).\n\nThis section describes how to store your API key so that it can be more securely\nreferenced by your app. For more information on API key security best practices,\nsee the Google Maps Platform article on [API security best practices](/maps/api-security-best-practices#restrict_apikey).\n| **Important:** Don't check your API key into your version control system. Instead, store it in the `local.properties` file, which is located in the root directory of your project. For more information about the `local.properties` file, see [Gradle properties files](https://developer.android.com/studio/build#properties-files).\n\nTo streamline this task, you can use the GitHub documentation\n[Secrets Gradle Plugin for Android](https://github.com/google/secrets-gradle-plugin).\n\nTo install the plugin and store your API key, follow these steps:\n\n1. Open your root-level `build.gradle` file and add the following code to the\n `dependencies` element under `buildscript`.\n\n Groovy \n\n buildscript {\n dependencies {\n // ...\n classpath \"com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0\"\n }\n }\n\n Kotlin \n\n buildscript {\n dependencies {\n // ...\n classpath(\"com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0\")\n }\n }\n\n2. Open your app-level `build.gradle` file and add the following code to the\n `plugins` element.\n\n Groovy \n\n id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'\n\n Kotlin \n\n id(\"com.google.android.libraries.mapsplatform.secrets-gradle-plugin\")\n\n3. If you use Android Studio, sync your project with Gradle. For details, see\n [Sync your project with Gradle](https://developer.android.com/studio/build#sync-files).\n\n4. Open the `local.properties` in your project level directory, and then add\n the following code. Replace `YOUR_API_KEY` with your API key.\n\n MAPS_API_KEY=\u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e\n5. In your `AndroidManifest.xml` file, go to `com.google.android.geo.API_KEY`\n and update the `android:value` attribute as follows:\n\n \u003cmeta-data\n android:name=\"com.google.android.geo.API_KEY\"\n android:value=\"${MAPS_API_KEY}\" /\u003e\n\nThe following example shows a complete manifest for a sample app: \n\n \u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.example.driverapidemo\" \u003e\n \u003cuses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /\u003e\n \u003cuses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /\u003e\n \u003capplication\n android:allowBackup=\"true\"\n android:icon=\"@mipmap/ic_launcher\"\n android:label=\"@string/app_name\"\n android:supportsRtl=\"true\"\n android:theme=\"@style/_AppTheme\" \u003e\n\n \u003cmeta-data\n android:name=\"com.google.android.geo.API_KEY\"\n android:value=\"${MAPS_API_KEY}\" /\u003e\n\n \u003cactivity android:name=\".MainActivity\" \u003e\n \u003cintent-filter\u003e\n \u003caction android:name=\"android.intent.action.MAIN\" /\u003e\n \u003ccategory android:name=\"android.intent.category.LAUNCHER\" /\u003e\n \u003c/intent-filter\u003e\n \u003c/activity\u003e\n \u003c/application\u003e\n \u003c/manifest\u003e\n\n| **Note:** For the best navigation experience, the driver should grant the following permissions: `android.permission.ACCESS_COARSE_LOCATION` and `android.permission.ACCESS_FINE_LOCATION`. Make sure to request both of those at runtime within the app.\n\nInclude the required attributions in your app\n\nIf you use the Driver SDK in your app, you must include attribution text and\nopen source licenses as part of your app's legal notices section. It's best to\ninclude the attributions as an independent menu item or as part of an **About**\nmenu item.\n\nYou can find the license information in the \"third_party_licenses.txt\" file in\nthe unarchived AAR file.\n\nRefer to [Include open source notices](https://developers.google.com/android/guides/opensource) on how to\ninclude open source notices.\n\nWhat's next\n\n[Declare dependencies](/maps/documentation/mobility/driver-sdk/scheduled/android/dependencies)"]]