0

Erros in log

ERROR: Gradle DSL method not found: 'google()' Possible causes: The project 'Project Name' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Upgrade plugin to version 3.4.0-alpha01 and sync project

The project 'Project Name' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file

The build file may be missing a Gradle plugin. Apply Gradle plugin

Gradle

    buildscript {
    google()
    maven {
        url 'https://maven.google.com'
    }
    jcenter()
    maven { url 'https://jitpack.io' }

    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven {
        url "https://maven.google.com"
    }
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://jitpack.io' }
}


android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "package"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.github.Kunzisoft:Android-SwitchDateTimePicker:2.0'
     implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'

    implementation 'com.flipboard:bottomsheet-commons:1.5.3'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.ramotion.foldingcell:folding-cell:1.2.1'
    implementation 'com.braintreepayments.api:drop-in:3.6.1'
    implementation('com.facebook.android:facebook-android-sdk:4.27.0') {
        exclude group: 'com.google.android.gms'
    }
    implementation('com.facebook.android:account-kit-sdk:4.+')
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'com.github.TheBrownArrow:PermissionManager:1.0.0'
    implementation 'com.loopj.android:android-async-http:1.4.9'

    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.github.jrvansuita:PickImage:2.2.4'
    implementation 'com.github.demoNo:AutoScrollViewPager:v1.0.2'
    implementation 'com.github.sujithkanna:smileyrating:1.6.8'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    implementation 'com.airbnb.android:lottie:2.3.0'
    implementation 'com.tubb.smrv:swipemenu-recyclerview:5.4.4'
    implementation 'com.yarolegovich:discrete-scrollview:1.3.2'
    implementation 'com.norbsoft.typefacehelper:library:0.9.0'
    implementation 'com.github.florent37:diagonallayout:1.0.7'
    implementation 'com.yinglan.shadowimageview:shadowimageview:1.0.4'
    implementation 'agency.tango.android:material-intro-screen:0.0.5'
}

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:28.0.0'
    }}

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

Build.gradle

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

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

        jcenter()
        maven { url 'https://jitpack.io' }

    }
    dependencies {
        classpath 'com.google.gms:google-services:4.0.2'
        classpath 'com.android.tools.build:gradle:3.4.0-alpha01'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        maven {
            url 'https://maven.google.com'
        }
        jcenter()
        mavenCentral()
        maven {
            url "http://dl.bintray.com/dasar/maven"
        }
        maven { url 'https://jitpack.io' }


    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
unknown
  • 91
  • 3
  • 14
  • `google()` should probably be located under `repositories {}` -> `repositories { google() }`. – Opal Oct 24 '18 at 10:42
  • Just tried repositories { google() maven { url "https://maven.google.com" } maven { url 'https://maven.fabric.io/public' } maven { url 'https://jitpack.io' } } But No Luck @Opal – unknown Oct 24 '18 at 10:46
  • see https://stackoverflow.com/a/46467800/6899896 : maybe you have an older version of Gradle, where `google()` is not yet available? – M.Ricciuti Oct 24 '18 at 10:52
  • @M.Ricciuti distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip thi is i have. – unknown Oct 24 '18 at 10:55
  • Hmm.. `buildscript` block is evaluated before plugins are applied. So if `google()` is provided with any plugin (and AFAIK it is) you can't have it defined in `buildscript`. Just in `repositories` defined for projects. – Opal Oct 24 '18 at 11:05
  • @Opal u mean to say is i should remove google() maven { url 'https://dl.google.com/dl/android/maven2/' } from buildscript { repositories { google() maven { url 'https://dl.google.com/dl/android/maven2/' } jcenter() maven { url 'https://jitpack.io' } } – unknown Oct 24 '18 at 11:08
  • Yup, this is what I'd try. – Opal Oct 24 '18 at 11:13
  • i did but same error buildscript { repositories { jcenter() maven { url 'https://jitpack.io' } } dependencies { classpath 'com.google.gms:google-services:4.0.2' classpath 'com.android.tools.build:gradle:3.4.0-alpha01' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } – unknown Oct 24 '18 at 11:18
  • @Opal yes by removing google() and maevn of google from app.gradle error gone...actually i have buildscript in both gradles – unknown Oct 24 '18 at 11:29
  • 1
    `google()` is part of Gradle Core since v4.+, no need to apply any plugin to be able to use this core DSL method. I'm almost sure that you are not using the correct Gradle version: I made a simple test by downgrading a working project in Gradle 4.10 to Gradle 3.6 and suddenly I get exactly the same error as yours ( `Gradle DSL method not found: 'google()' `) , using `google()` in both `buildscript.repositories` and `repositories` block. You should try to cleanup .gradle directory , close/resynch your project and try rebuild it. – M.Ricciuti Oct 24 '18 at 11:29
  • @M.Ricciuti actually gradle is latest and i solved it by removing e google() maven { url 'dl.google.com/dl/android/maven2' } from Builscript . – unknown Oct 24 '18 at 11:31

0 Answers0