Maps SDK for Android Utility Setup
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
پلتفرم را انتخاب کنید: Android iOS این صفحه نحوه راهاندازی Maps SDK برای کتابخانه ابزار Android و اجرای برنامه نمایشی موجود در کتابخانه را توضیح میدهد.
پیش نیازها و نکات
کتابخانه ابزار Maps SDK for Android از Android API سطح 15 و بالاتر پشتیبانی می کند. هنگام تنظیم هدف ساخت پروژه خود، مطمئن شوید که از آخرین سطح API Android استفاده می کنید.
مستندات مرجع در GitHub موجود است.
مرحله 1. کتابخانه ابزار Android Maps SDK را نصب کنید
وابستگی زیر را به فایل build.gradle.kts
برنامه خود اضافه کنید:
dependencies {
// Utility Library for Maps SDK for Android
// You do not need to add a separate dependency for the Maps SDK for Android
// since this library builds in the compatible version of the Maps SDK.
implementation("com.google.maps.android:android-maps-utils:3.14.0")
}
از یکی از ابزارهای کتابخانه مانند خوشه بندی نشانگر ، نقشه حرارتی یا سایر ابزارها استفاده کنید.
مرحله 2. (اختیاری) Maps SDK برای کتابخانه ابزار Android KTX را نصب کنید
کتابخانه ابزار Maps SDK برای Android با یک کتابخانه برنامههای افزودنی Kotlin (KTX) مربوطه ارائه میشود. این کتابخانه ویژگیهای زبان کاتلین را فراهم میکند - مانند توابع پسوند، آرگومانهای نامگذاری شده و پیشفرض - تا شما را قادر میسازد کوتلین مختصر و اصطلاحی بنویسید. اگر در کاتلین در حال توسعه نیستید، می توانید از این مرحله صرف نظر کنید.
برای استفاده از این کتابخانه، علاوه بر وابستگی android-maps-utils
، وابستگی زیر را به فایل build.gradle.kts
برنامه خود اضافه کنید:
dependencies {
// KTX for the Maps SDK for Android Utility Library
implementation("com.google.maps.android:maps-utils-ktx:5.2.0")
}
برای اطلاعات بیشتر درباره این کتابخانه، صفحه Maps KTX GitHub را بررسی کنید.
مرحله 3. کد منبع کتابخانه ابزار Android Maps SDK را مشاهده کنید
از آنجایی که کتابخانه ابزار منبع باز است، میتوانید کتابخانه android-maps-utils را در دستگاه خود دانلود کنید تا آن را سفارشی کنید، برنامه آزمایشی را مشاهده کنید، یا اگر فقط میخواهید بدانید که چگونه کتابخانه کار میکند. میتوانید این کار را با شبیهسازی مخزن (توصیه میشود، برای دریافت بهروزرسانیهای خودکار) یا دانلود یک فایل فشرده انجام دهید. اگر میخواهید کتابخانه را سفارشی کنید، باید مخزن را جدا کنید .
مخزن شامل:
- یک برنامه آزمایشی، در فهرست
demo
. - کتابخانه خدمات، در فهرست راهنمای
library
. - فایل های مختلف حاوی مجوز، مشارکت کنندگان و اطلاعات readme.
- پیکربندی Gradle build، برای استفاده با Android Studio.
برنامه دمو ابزار را اجرا کنید
مخزن GitHub برای کتابخانه ابزار با یک برنامه آزمایشی ارائه می شود که شامل اجرای نمونه های هر ابزار است. برای اجرای برنامه دمو در دستگاه اندرویدی خود این مراحل را دنبال کنید.
- با استفاده از یکی از گزینه های ذکر شده در بالا، مخزن را دانلود کنید.
- در Android Studio، File -> New -> Import Project را انتخاب کنید.
- فهرست راهنمای android-maps-utils را که هنگام کلون کردن کتابخانه ابزار ایجاد شده است، مرور کرده و (دوبار کلیک کنید) انتخاب کنید. Android Studio اکنون پروژه را می سازد.
- اگر به جای شبیه ساز از یک دستگاه Android استفاده می کنید، مطمئن شوید که حالت برنامه نویس را فعال کنید . سپس دستگاه اندروید را به رایانه خود وصل کنید.
یک خط به local.properties
اضافه کنید که به شکل زیر است:
MAPS_API_KEY=YOUR_API_KEY
جایی که YOUR_API_KEY کلید API است که همانطور که در استفاده از کلیدهای API توضیح داده شده است.
- برنامه دمو را بسازید و اجرا کنید.
برنامه باید در دستگاه Android باز شود و لیستی از ابزارهای کاربردی از جمله خوشه بندی، poyutil، نقشه حرارتی و موارد دیگر را نمایش دهد. همچنین میتوانید برنامه را در فهرست برنامههای خود، تحت نام Maps Utils Demo پیدا کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThis page explains how to set up the Maps SDK for Android utility library and run its demo app, allowing you to utilize features like marker clustering and heatmaps.\u003c/p\u003e\n"],["\u003cp\u003eThe library supports Android API level 15 and above, requiring you to add a specific dependency to your app's \u003ccode\u003ebuild.gradle.kts\u003c/code\u003e file for implementation.\u003c/p\u003e\n"],["\u003cp\u003eAn optional Kotlin extensions (KTX) library provides Kotlin-specific features for more concise coding if you are developing in Kotlin.\u003c/p\u003e\n"],["\u003cp\u003eThe open-source nature of the library allows for customization by cloning or downloading the \u003ccode\u003eandroid-maps-utils\u003c/code\u003e repository from GitHub.\u003c/p\u003e\n"],["\u003cp\u003eYou can explore the functionalities of the library by running the demo app included in the repository, requiring steps like adding your API key and building the project in Android Studio.\u003c/p\u003e\n"]]],["To set up the Maps SDK for Android utility library, add the `android-maps-utils` dependency to your `build.gradle.kts` file. Optionally, include the `maps-utils-ktx` dependency for Kotlin features. The library, which supports Android API level 15 and above, is open-source and can be downloaded from GitHub. To run the included demo app, clone the repository, import the project into Android Studio, enable developer mode on your Android device, add your API key to `local.properties`, and then build and run the app.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/utility/setup \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/utility/setup \"View this page for the iOS platform docs.\")\n\nThis page describes how to set up the\n[Maps SDK for Android\nutility library](https://github.com/googlemaps/android-maps-utils), and to run the demo app included in the library.\n\nPrerequisites and notes\n\nThe Maps SDK for Android utility library supports Android\n[API\nlevel](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) 15 and above. When setting your project build target, make sure you use the latest\nAndroid API level.\n\nThe\n[reference\ndocumentation](http://googlemaps.github.io/android-maps-utils/javadoc/) is available on GitHub.\n\nStep 1. Install the Maps SDK for Android utility library\n\nAdd the following dependency to your app's `build.gradle.kts` file: \n\n```carbon\ndependencies {\n\n\n // Utility Library for Maps SDK for Android\n // You do not need to add a separate dependency for the Maps SDK for Android\n // since this library builds in the compatible version of the Maps SDK.\n implementation(\"com.google.maps.android:android-maps-utils:3.14.0\")\n}\n```\n\nUse one of the utilities from the library, such as\n[marker\nclustering](/maps/documentation/android-sdk/utility/marker-clustering),\n[heatmaps](/maps/documentation/android-sdk/utility/heatmap), or\nthe [other\nutilities](/maps/documentation/android-sdk/utility).\n\nStep 2. (Optional) Install the Maps SDK for Android utility KTX library\n\nThe Maps SDK for Android utility library comes with a corresponding Kotlin extensions\n(KTX) library. This library provides Kotlin language features---such as extension functions, named\nand default arguments---to enable you to write concise and idiomatic Kotlin. If you are not\ndeveloping in Kotlin, you can skip this step.\n\nTo use this library, add the following dependency, in addition to the\n`android-maps-utils` dependency, to your app's `build.gradle.kts` file: \n\n```carbon\ndependencies {\n\n // KTX for the Maps SDK for Android Utility Library\n implementation(\"com.google.maps.android:maps-utils-ktx:5.2.0\")\n}\n```\n\nCheck out the [Maps KTX GitHub](https://github.com/googlemaps/android-maps-ktx) page\nfor additional information about this library.\n\nStep 3. View the Maps SDK for Android utility library source code\n\nSince the utility library is open source, you can download the\n[android-maps-utils](https://github.com/googlemaps/android-maps-utils)\nlibrary to your machine to customize it, view the demo app, or if you just want to understand how\nthe library works. You can do so by\n[cloning](https://github.com/googlemaps/android-maps-utils.git) the repo (recommended,\nto receive automatic updates) or\n[downloading\na zip file](https://github.com/googlemaps/android-maps-utils/archive/master.zip). If you want to customize the library, you should\n[fork the repo](https://help.github.com/articles/fork-a-repo).\n\nThe repository includes:\n\n- A demo application, in the `demo` directory.\n- The library of utilities, in the `library` directory.\n- Various files containing license, contributors, and readme information.\n- Gradle build configuration, for use with Android Studio.\n\nRun the utility demo app\n\nThe GitHub repository for the utility library ships with a demo app that includes sample\nimplementations of each utility. Follow these steps to run the demo app on\nyour Android device.\n\n1. Download the repository using one of the options mentioned above.\n2. In Android Studio, choose **File -\\\u003e New -\\\u003e Import Project**.\n3. Browse to and select (double-click) the **android-maps-utils** directory that was created when you cloned the utility library. Android Studio now builds the project.\n4. If you are using an Android device instead of an emulator, make sure to [enable developer mode](https://developer.android.com/tools/device.html#setting-up). Then attach the Android device to your computer.\n5. Add a single line to `local.properties` that looks like this:\n\n ```scdoc\n MAPS_API_KEY=YOUR_API_KEY\n ```\n\n Where \u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e is the API key you obtained as described in\n [Using API Keys](/maps/documentation/android-sdk/get-api-key).\n6. Build and run the **demo** app.\n\nThe app should open on the Android device, displaying a list of utilities\nincluding clustering, poyutil, heatmap, and more. You can also find the app in\nyour app list, under the name **Maps Utils Demo**."]]