简体   繁体   English

错误:(33, 0) 找不到参数的方法 classpath() [com.google.gms:google-services:3.0.1]

[英]Error:(33, 0) Could not find method classpath() for arguments [com.google.gms:google-services:3.0.1]

Trying to configure Firebase for my android project.尝试为我的 android 项目配置 Firebase。 But I get sync error.但我收到同步错误。

build.gradle app directory: build.gradle应用程序目录:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.yunus.relichunter"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.google.firebase:firebase-core:11.8.0'

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    classpath 'com.google.gms:google-services:3.0.1'

}




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

build.gradle root directory : build.gradle根目录:

buildscript {

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


        // 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" // Google's Maven repository
        }
        jcenter()
    }
}

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

在此处输入图片说明

You can see the error on the image shown above.您可以在上图中看到错误。 I have tried to install Firebase using its assistance (tools/Firebase) then I tried to do it normally.我尝试使用它的帮助(工具/Firebase)安装 Firebase,然后我尝试正常进行。

As @tyczj says, you can't use classpath 'com.google.gms:google-services:3.0.1' in your module build.gradle (like app module) dependencies block.正如@tyczj 所说,您不能在模块build.gradle(如应用程序模块)依赖项块中使用classpath 'com.google.gms:google-services:3.0.1' You only can use it in your project or root build.gradle dependencies block.您只能在您的项目build.gradle 依赖项块中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到 arguments [com.google.gms:google-services:3.0.0] 的方法 classpath() - Could not find method classpath() for arguments [com.google.gms:google-services:3.0.0] 找不到 arguments [com.google.gms:google-services:4.0.0] 的方法 compile() - Could not find method compile() for arguments [com.google.gms:google-services:4.0.0] 找不到com.google.gms:google-services:9.0.0 - Could not find com.google.gms:google-services:9.0.0 找不到 com.google.gms:google-services:4.2.3 - Could not find com.google.gms:google-services:4.2.3 找不到com.google.gms:google-services:3.1.1 - Could not find com.google.gms:google-services:3.1.1 收到错误消息“找不到com.google.gms:google-services:2.0.0-alpha6。” - Getting error message “Could not find com.google.gms:google-services:2.0.0-alpha6.” 错误:将Firebase导入代码示例时,找不到com.google.gms:google-services:3.0.0 - Error:Could not find com.google.gms:google-services:3.0.0 when importing Firebase to a code sample 如何修复错误:找不到 com.google.gms: google-services: 3.0.0.? - How to fix Error:Could not find com.google.gms: google-services: 3.0.0.? 错误:找不到com.google.gms:google-services:3.0.0 - Error:Could not find com.google.gms:google-services:3.0.0 错误:找不到com.google.gms:google-services:4.2.0 - Error: could not find com.google.gms:google-services:4.2.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM