Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 找不到参数[com.google.gms:google services:3.1.1]的compile()方法_Android_Android Gradle Plugin_Google Play Services - Fatal编程技术网

Android 找不到参数[com.google.gms:google services:3.1.1]的compile()方法

Android 找不到参数[com.google.gms:google services:3.1.1]的compile()方法,android,android-gradle-plugin,google-play-services,Android,Android Gradle Plugin,Google Play Services,在尝试更新到最新的Glide时,我得到了更新新谷歌服务的信息,我已经将它介绍给了gradle,从这一刻起,任何想法都不起作用。 我所尝试的: 1) 我已经读到,当某些依赖项的版本与其他依赖项的版本不同时,可能会发生此错误,因此我尝试//(临时删除)所有依赖项,而不是逐个“取消”依赖项以获得有问题的依赖项,但这并没有解决问题 2) 我试图编译com.google.gms:googleservices:3.1.1/3.1.2/3.0.0/3.1.0,但这些都不起作用 3) 我尝试了来自和强制编译的方

在尝试更新到最新的Glide时,我得到了更新新谷歌服务的信息,我已经将它介绍给了gradle,从这一刻起,任何想法都不起作用。 我所尝试的:

1) 我已经读到,当某些依赖项的版本与其他依赖项的版本不同时,可能会发生此错误,因此我尝试//(临时删除)所有依赖项,而不是逐个“取消”依赖项以获得有问题的依赖项,但这并没有解决问题

2) 我试图编译com.google.gms:googleservices:3.1.1/3.1.2/3.0.0/3.1.0,但这些都不起作用

3) 我尝试了来自和强制编译的方法,但没有成功

我得到的错误

错误:(10,0)在org.gradle.api.internal.artifacts.dsl.dependency.DefaultDependencyHandler类型的对象上找不到参数[com.google.gms:google services:3.1.1]的方法compile()。 打开文件

我将非常感激任何帮助

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

buildscript {
    ext.kotlin_version = '1.1.51'
    repositories {
        jcenter()
        google()
    }
    dependencies {
        compile '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
       compile 'com.google.gms:google-services:3.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

       classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    }
}

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

    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
第二次建造,格雷德尔

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.example.lenovo.licz4"
        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 {
    implementation 'com.android.support:support-v4:26.1.0'
    implementation "android.arch.lifecycle:extensions:1.0.0-rc1"
    implementation "android.arch.lifecycle:runtime:1.0.3"
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    annotationProcessor "android.arch.lifecycle:compiler:1.0.0-rc1"
    annotationProcessor 'com.github.bumptech.glide:compiler:4.3.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'
    })

    compile 'com.android.support:preference-v14:26.1.0'
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:preference-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-core:11.4.2'
    compile 'com.github.bumptech.glide:glide:4.3.0'

   testCompile 'junit:junit:4.12'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

}




apply plugin: 'com.google.gms.google-services'
repositories {
    mavenCentral()
}
apply plugin: 'kotlin-android-extensions'

删除顶级文件中的以下行:

compile 'com.google.gms:google-services:3.1.1'
compile 'com.google.gms:google-services:3.1.0'
添加

classpath 'com.google.gms:google-services:3.1.0'

非常感谢你!为了让它正常工作,我必须添加两个类路径,但不要介意这个小缺点,谢谢classpath'com.android.tools.build:gradle:3.0.0'classpath'com.google.gms:google services:3.1.0'