Gradle DSL方法未找到:'implementation()'

6 浏览
0 Comments

Gradle DSL方法未找到:'implementation()'

我遇到了这个错误

Error:(45, 0) Gradle DSL method not found: 'implementation()'
Possible causes:

build.gradle 内容

// 顶级构建文件,您可以在其中添加所有子项目/模块的通用配置选项。
buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
//        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        /* 将classpath更改为 'com.android.tools.build:gradle:2.3.3' 以获取稳定的构建工具版本 */
//        classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'
        // 我们建议根据我们的更改日志将其更改为最新版本:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1+'
        // 注意:不要将应用程序的依赖项放在这里;它们属于各个模块的 build.gradle 文件
    }
}
allprojects {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
//        google()
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

build .gradle 模块应用

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
    maven {
        url 'https://maven.google.com'
    }
//    google()
    maven { url 'https://maven.fabric.io/public' }
}
android {
    compileSdkVersion 25
    buildToolsVersion '26.0.0'
    defaultConfig {
        applicationId "in.techware.lataxi"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 5
        versionName "1.0.4"
        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'
    })
    /* Remove This to remove Crashlytics and Fabric */
    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }
/*    compile('com.digits.sdk.android:digits:2.0.6@aar') {
        transitive = true;
    }*/
    implementation 'com.android.support:appcompat-v7:25.4.0'
    implementation 'com.android.support:design:25.4.0'
    implementation 'com.android.support:recyclerview-v7:25.4.0'
    implementation 'com.squareup.okhttp3:okhttp:3.8.1'
    implementation 'com.android.support:cardview-v7:25.4.0'
    implementation 'com.github.bumptech.glide:glide:3.8.0'
    implementation 'com.google.android.gms:play-services-maps:11.0.2'
    implementation 'com.google.android.gms:play-services-location:11.0.2'
    implementation 'com.google.android.gms:play-services-places:11.0.2'
    implementation 'com.google.firebase:firebase-auth:11.0.2'
    implementation 'com.google.firebase:firebase-messaging:11.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
    implementation 'com.google.code.gson:gson:2.8.0'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

0