This guide shows you how to install the Maps SDK for Android v.3.1.0 BETA. Once you're set up, learn how to use the new features.
Install the Maps SDK for Android v3.1.0 BETA
Follow these steps to manually add the v3.1.0 Beta Maps SDK for Android client library to your Android Studio project.
-
Download the Places static library (you can skip this step if not using Places):
- places-maps-sdk-3.1.0-beta.aar (optional, for use only with Maps v 3.1.0 beta)
- Copy the AAR file into the
app/libs
folder of your Android Studio project. -
In the
buildscript.repositories
section of your top-levelbuild.gradle
file, make sure Google's Maven repo is listed:buildscript { repositories { google() // ... } }
-
In the
dependencies
section of your app-levelbuild.gradle
file, add the Maps SDK for Android, and optionally, the Places static library and its required dependencies:dependencies { implementation 'com.google.android.libraries.maps:maps:3.1.0-beta' // If you are using Places, add all of the dependencies below implementation name:'places-maps-sdk-3.1.0-beta', ext:'aar' implementation 'com.google.android.gms:play-services-gcm:17.0.0' implementation 'com.google.auto.value:auto-value-annotations:1.6.2' }
In the
dependencies
section of your app-levelbuild.gradle
file, remove the implementation line for the previous version (it will appear similar to the following):- Sync your Gradle project.
Convert existing configurations.
- If your existing app uses the Maps SDK for Android via Google Play services,
replace all references to the
com.google.android.gms.maps
package with thecom.google.android.libraries.maps
package (use Edit > Replace in Path... in Android Studio). - If your existing app uses the Google Maps Platform Premium Plan,
replace all references to the
com.google.android.m4b.maps
package with thecom.google.android.libraries.maps
package. Also, remove them4b_
prefix from all references to the XML layout attributes. For example:m4b_mapType
should becomemapType
andm4b_cameraZoom
should becomecameraZoom
.
- If your existing app uses the Maps SDK for Android via Google Play services,
replace all references to the
The Maps SDK for Android library is available through Google's Maven repository. To add the SDK to your app, do the following:
implementation 'com.google.android.gms:play-services-maps:17.0.0'
If you are using the Google Maps Platform Premium Plan, the implementation line to remove looks like one of the following:
implementation(name:'google-maps-sdk-m4b', ext:'aar') implementation project(':googlemapssdkm4b_lib')
Import the beta-compatible utility library
If you are using the Google Maps Android API utility library, you will need to also update your project dependencies to replace the existing version with the beta-compatible version by doing the following:
- Import the beta-compatible util library in your
build.gradle
file:implementation 'com.google.maps.android:android-maps-utils-v3:1.3.1'
- Remove the following from your
build.gradle
to remove non-beta-compatible utility library:implementation 'com.google.maps.android:android-maps-utils:1.3.1'
Run the samples
The Google Samples repository on GitHub includes sample apps that demonstrate the use of the v3.1.0 Beta Maps SDK for Android.
- Maps SDK for Android samples
- Places SDK for Android samples (only for use with Maps v3.1.0 beta)