使用firebase时android studio 2.3.2中的gradle错误

时间:2017-07-03 19:07:13

标签: android firebase firebase-authentication

我在我的android studio应用程序中使用firebase。然而,我坚持这个问题,我已尽一切可能想出来,但我无法。请帮忙。

这是错误:

  

Gradle sync失败:找不到参数的方法classpath()   关于类型对象的[com.android.tools.build:gradle:2.3.3]   org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。

顶级gradle.build代码

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

        allprojects {
            repositories {
                jcenter()
            }
        }

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

其他gradle代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.mobility.mobilityindia"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.1.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    String googleSupportVersion = '25.3.1'
    String googlePlayServicesVersion = '11.0.2'

    compile "com.google.firebase:firebase-core:$googlePlayServicesVersion"
    compile "com.google.firebase:firebase-auth:$googlePlayServicesVersion"
    compile "com.android.support:appcompat-v7:$googleSupportVersion"
    compile "com.android.support:support-v4:$googleSupportVersion"
    compile "com.google.android.gms:play-services:$googlePlayServicesVersion"
    compile "com.android.support:design:$googleSupportVersion"
    compile 'com.android.support.constraint:constraint-layout:1.0.2'



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

1 个答案:

答案 0 :(得分:2)

从Android级别build.gradle文件中删除这两个

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'   <-- 1.
    classpath 'com.google.gms:google-services:3.1.0'   <-- 2.
    ...
    ...

}