Jakub Mitura
Jakub Mitura

Reputation: 167

Could not find method compile() for arguments [com.google.gms:google-services:3.1.1]

While trying to update to newest Glide I had information to update new google services I have introduced It to gradle and from this moment nothink works. What I had tried:

1) I have read that This error can happen when some of the dependencies have diffrent versions than others So i tried to // (temporarly delete) all dependencies In order than to "UnHash" dependencies one by one to get to problematic one but it Did not solved the problem

2) I tried to compile com.google.gms:google-services:3.1.1/ 3.1.2/3.0.0/3.1.0 but none of this works

3) I tried methods from https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f and forcing true the compile but without success

The error I get

Error:(10, 0) Could not find method compile() for arguments [com.google.gms:google-services:3.1.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Open File

I will be Deeply gratefull for any help!

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

And second 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'

Upvotes: 2

Views: 6143

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363479

Remove these lines in your top level file:

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

and add:

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

Upvotes: 4

Related Questions