Error: Gradle DSL method not found: 'google ()'

I am trying to add an external library to my existing project. I created the libs folder and added my MaterialDrawer library to the root directory. Here is my settings.gradle file :

include ':app'
include 'libs:MaterialDrawer'

But gradle failed to synchronize and get the following error:

Error: Gradle DSL method not found: 'google ()'

I could not find a solution in SO regarding my problem. Would anyone be kind to help?

Here is build.gradle (Project) :

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

Here is build.gradle (app) :

android {compileSdkVersion 25 buildToolsVersion '25 .0.0 '

defaultConfig {
    applicationId "com.myapp"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 38
    versionName "2.1.8"

    generatedDensities = []

}

dexOptions {
    javaMaxHeapSize "4g"
}

aaptOptions {
    additionalParameters "--no-version-vectors"
}

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

tasks.whenTaskAdded { task ->
    if (task.name.equals("lint")) {
        task.enabled = false
    }
}

repositories {
    mavenCentral()
    maven { url "https://jitpack.io"}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(":libs:MaterialDrawer")
}

apply plugin: 'com.google.gms.google-services'
+4
source share
1 answer

google() Gradle 4.0
maven { url 'https://maven.google.com' }

repositories build.gradle ( root build.gradle)

, build.gradle

compile('com.mikepenz:materialdrawer:5.9.5@aar') {
    transitive = true
}
+2

Source: https://habr.com/ru/post/1684652/


All Articles