Android Studio 0.2 App that use Google Maps - Gradle modify

android, android-studio, google-maps, java

Solution

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!

Problem

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.

Original source

Related problems