无法为参数找到方法compile()[com.google.gms:google-services:3.1.1]

时间:2017-11-04 19:53:02

标签: android android-gradle google-play-services

在尝试更新到最新的Glide时,我有更新新的谷歌服务的信息,我已经介绍了它的gradle,从这一刻起,nothink工作。 我曾尝试过:

1)我已经读过这个错误可能发生在某些依赖项比其他版本具有不同的版本时所以我试图//(临时删除)所有依赖项为了比“UnHash”依赖项一个接一个地解决问题一个但它没有解决问题

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

3)我尝试了https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f中的方法并强制编译但没有成功

我得到的错误

  

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

我将非常感激您的帮助!

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

第二个build.gradle

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'

1 个答案:

答案 0 :(得分:1)

在您的顶级文件中

删除这些行:

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'