Android 未找到Gradle DSL方法:';类路径()';添加firebaseui库后

Android 未找到Gradle DSL方法:';类路径()';添加firebaseui库后,android,firebase,gradle,firebaseui,Android,Firebase,Gradle,Firebaseui,我添加了firebase UI库,在添加GoogleMaven之后,我得到了一个错误。 可能的原因是,我使用的Android Gradle插件版本不包含该方法,但我升级了插件,仍然出现错误 以下是模块梯度文件: apply plugin: 'com.android.application' repositories { mavenLocal() flatDir { dirs 'libs' } } android { compileSdkVer

我添加了firebase UI库,在添加GoogleMaven之后,我得到了一个错误。 可能的原因是,我使用的Android Gradle插件版本不包含该方法,但我升级了插件,仍然出现错误

以下是模块梯度文件:

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'
和project Gradle文件:

// 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
}

更改project Gradle文件后,我得到了解决方案:

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()
        } }

你有一个}不在它的位置上

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
}