0

when I add 'com.google.firebase:firebase-auth:11.4.2' to my Gradle I receive an Error "Gradle DSL method not found: compile()"

this is my App/Gradle

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        buildToolsVersion "26.0.2"
        defaultConfig {
            applicationId "com.watchmecoding.eazynote"
            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 fileTree(include: ['*.jar'], dir: 'libs')
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support:design:25.3.1'
        testCompile 'junit:junit:4.12'
        compile 'com.google.code.gson:gson:2.8.2'
        compile 'com.google.firebase:firebase-core:11.4.2'
        compile 'com.google.firebase:firebase-database:11.4.2'
        compile 'com.google.firebase:firebase-crash:11.4.2'
        compile 'com.google.firebase:firebase-ads:11.4.2'
        compile 'com.google.firebase:firebase-config:11.4.2'
        compile 'com.google.firebase:firebase-storage:11.4.2'
        compile 'com.google.firebase:firebase-analytics:11.4.2'
        comlile 'com.google.firebase:firebase-auth:11.4.2'
    }
apply plugin: 'com.google.gms.google-services'

and here is my project/gradle

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        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"
        }
        jcenter()
    }
}

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

my repository is update, and i did everything just like the tutorial, but still have this problem, versions are all the same too. thanks in advance.

enter image description here

Arash Afsharpour
  • 1,282
  • 11
  • 22

4 Answers4

1

Change your SourceCode

comlile 'com.google.firebase:firebase-auth:11.4.2'

to

compile 'com.google.firebase:firebase-auth:11.4.2'
1

I have got it.

You only need to change the version like this compile 'com.google.firebase:firebase-database:10.2.1'

0

At the end one line is missing refer this doc

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'com.google.firebase:firebase-core:11.4.2'
    compile 'com.google.firebase:firebase-database:11.4.2'
    compile 'com.google.firebase:firebase-crash:11.4.2'
    compile 'com.google.firebase:firebase-ads:11.4.2'
    compile 'com.google.firebase:firebase-config:11.4.2'
    compile 'com.google.firebase:firebase-storage:11.4.2'
    compile 'com.google.firebase:firebase-analytics:11.4.2'
    comlile 'com.google.firebase:firebase-auth:11.4.2'
}
//add this line to bottom
apply plugin: 'com.google.gms.google-services'
Aalap Patel
  • 2,058
  • 2
  • 17
  • 31
0

You have to put the plugin ( apply plugin: 'com.google.gms.google-services') on the bottom of the dependencies. I am sure that will help to resolve your problem.

Olcay Sönmez
  • 602
  • 1
  • 7
  • 16
  • i did that, still got a problem, actually i missed when i copied the code here, it was there from the beginning still got the error. – Arash Afsharpour Oct 18 '17 at 18:52
  • do i have to put apply plugin: 'com.google.gms.google-services' in both app gradle and project gradle? – Arash Afsharpour Oct 18 '17 at 18:53
  • No , you have to just put into app/gradle. Can you show the error that you get it will be easier to help you. – Olcay Sönmez Oct 18 '17 at 19:01
  • https://stackoverflow.com/questions/27617687/gradle-dsl-method-not-found-compile maybe this link can help you. – Olcay Sönmez Oct 18 '17 at 19:04
  • it seems that you use **"compileSdkVersion 26, buildToolsVersion "26.0.2"** the Oreo version but your support library still the version of 25. you have to change them too. Look at the link that I send you too. Maybe it will help you. – Olcay Sönmez Oct 18 '17 at 19:10
  • I added the image of error in to the post, also gradle works fine without "comlile 'com.google.firebase:firebase-auth:11.4.2' " this one, when Im adding it to Gradle thats when I run into error – Arash Afsharpour Oct 18 '17 at 19:21
  • can put the **auth:11.4.2** above from **compile 'com.google.firebase:firebase-core:11.4.2** an sync it again. please – Olcay Sönmez Oct 18 '17 at 19:39
  • I did that too, still I have this problem – Arash Afsharpour Oct 18 '17 at 19:56