Xample
Xample

Reputation: 15

Gradle DSL method not found: 'classpath()' after adding firebaseui libraries

I've added firebase UI libs, and after adding Google maven I get error. Possible cause is that I’m using version of the Android Gradle plug-in that does not contain the method, but I've upgraded plugin and still getting error.

Here is module Gradle file :

apply plugin: 'com.android.application'


repositories {
    mavenLocal()
    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.google.firebase.udacity.friendlychat"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true

    }
    dexOptions {
        javaMaxHeapSize = "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:design:24.2.0'
    compile 'com.android.support:appcompat-v7:24.2.0'

    // Displaying images
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.google.firebase:firebase-core:11.0.2'
    compile 'com.google.firebase:firebase-storage:11.0.2'
    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.android.gms:play-services:11.0.2'
    compile 'com.firebaseui:firebase-ui:2.1.0'



}

apply plugin: 'com.google.gms.google-services'

and project Gradle files :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenLocal()
    }
    }
    dependencies {
        apply plugin: 'idea'
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }


allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}

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

Upvotes: 1

Views: 915

Answers (2)

Uriel Frankel
Uriel Frankel

Reputation: 14622

You have one } that is not in its place.

buildscript {
    repositories {
        jcenter()
        mavenLocal()

    }
    dependencies {
        apply plugin: 'idea'
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}

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

Upvotes: 0

Xample
Xample

Reputation: 15

After changing project Gradle files, I've got solution :

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}
    allprojects {
        repositories {
            jcenter()
        } }

Upvotes: 1

Related Questions