Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Been trying to resolve this error for hours...cant get it solved. I am a newbie to Android Studio

My project level build.gradle file is as follows

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

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

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:4.0.1'

    }
}

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

And my app build.gradle file is as follows

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 18
    buildToolsVersion "26.0.1"

    defaultConfig {
        applicationId "com.amazonaws.androidtest"
        minSdkVersion 8
        targetSdkVersion 18
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    aaptOptions {
        cruncherEnabled = false
    }

    dependencies {
        implementation 'com.google.firebase:firebase-core:16.0.1'

    }
}

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

Getting the following error when trying to sync

Gradle sync failed: Could not find method implementation() for arguments [com.google.firebase:firebase-core:16.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I am using Android Studio 2.3

Tried to upgrade Gradle to version 4 but that requires Android Studio 3. Cant install Android Studio 3 for now.

Also added the maven url's as some answers suggested. Still not working.

Any other way to resolve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
270 views
Welcome To Ask or Share your Answers For Others

1 Answer

with build-tools 3.1.4, it should become known (read below):

classpath "com.android.tools.build:gradle:3.1.4"

but if you cannot update Android Studio , use compile instead of implementation.

compile "com.google.firebase:firebase-core:16.0.3"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...