错误:找不到Gradle DSL方法:“ google()”可能的原因:

时间:2018-10-24 10:40:27

标签: android gradle

登录错误

  

错误:未找到Gradle DSL方法:“ google()”   可能的原因:   项目“项目名称”可能使用了不包含该方法的Android Gradle插件版本(例如,在1.1.0中添加了“ testCompile”)。   将插件升级到版本3.4.0-alpha01并同步项目

项目“项目名称”可能正在使用不包含该方法的Gradle版本。 打开Gradle包装器文件

构建文件可能缺少Gradle插件。 应用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'
    }}

应用插件:“ 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
}

0 个答案:

没有答案