Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Google Play Services Adding Play Services to your App Adding the Code Library and Permissions

Having problems setting up support libraries and Google Play

According to a document I read we can no longer import support libraries through build.gradle. I do not have the extras folder in the SDK manager.

Here is what I have in the dependencies for build.gradle (Module)

compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:support-core-utils:23.1.0' complie 'com.google.android.gms:play-services-plus:6.5.87'

Here is what I have for build.gradle(Project) allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } }

This is what I have in the manifest file as per the video.

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"

I get the error Gradle DSL method not found?

1 Answer

Could you share the document you read? I'm curious because as far as I know, that is not true however the "compile" keyword will be deprecated and should be replaced by "implementation" in your case.

I wonder if you just copied and pasted the code you posted if so just try to replace

complie 'com.google.android.gms:play-services-plus:6.5.87'

to

compile 'com.google.android.gms:play-services-plus:6.5.87'

but I suggest you to update your files as below

build.gradle(Project)

buildscript {
    ext.kotlin_version = '1.2.51'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:3.3.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle(APP)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "you app ID"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            applicationIdSuffix ".debug"
            debuggable true
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    //Support
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.google.android.gms:play-services-plus:15.0.1'
    implementation 'com.android.support:support-core-utils:27.1.1'
}