I'm developing an App in Android studio. And I want use a Google maps API, but I can't use UI to configure project settings. I tried some different instruction to add maps, but it didn't work. I have to modify somehow build.gradle file? Can you tell me how? Does someone have experience with that?
Thanks for every advice.
Android Studio is the recommended development environment for building an app with the Maps SDK for Android. Step 1. Download Android Studio Follow the guides to download and install Android Studio. Step 2. Install the Google Play services SDK Add Google Play services to Android Studio. Step 3. Create a Google Maps project
In order to use the Google MapsAPI, you must register your application on the Google Developer Console and enable the API. Table Of Contents 1Steps For Getting The Google Maps Api Key: 2Google Maps Example To Access User Current Location In Android Studio: 3Google Map Example To Draw A Route Between Two Locations In Android Studio:
The overall process of adding a map to an Android application is as follows: Install Android Studio. Install and configure the Google Play services SDK, which includes the Maps SDK for Android. Get an API key. Add the required settings to your application's manifest.
To do so, you need to manually configure your project and then add the map. Android Studio is required. If you haven't already done so, download and install it. Add the Google Play services SDK to Android Studio.
If you are on 0.2 it means that you already have Google Repository and Android Repository installed(from Android SDK: terminal$ android sdk
).
One of them, has the Google Play services. Here is a full build.gradle for your module:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
dependencies {
compile 'com.google.android.gms:play-services:3.1.36'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 16
}
}
Notice how(easily) the play services can be included.
Also gradle version is 0.5.+ so it can be auto updated!
Also another VERY important thing, that wasted me a lot of time is the minimum sdk version! It must be 8 or above, since google play services aren't supported for lower versions!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With