Getting a Maps API Key
As of this writing, the template will also automatically add the com.google.android.gms:play-
services artifact to your dependencies. Unfortunately, this artifact is gigantic and will immediately
cause you to blow out your method limit budget and fail to build. (Basic Android apps currently
support up to 65,536 methods in an APK. If you need more than that, you will need to use multidex, a
topic that is beyond the scope of this book.)
Fix this by removing the services dependency (but leave play-services-location and play-
services-maps).
Listing 34.2 Removing Play Services dependency (app/build.gradle)
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
testCompile 'junit:junit:4.12'
}
With that, you are ready to go.