无法获取类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象的未知属性'implementation'。

5

我已经查找了之前的帖子,但没能找到我的问题的答案。以下是我的 build.gradle 文件的代码:

错误:在评估项目“:app”时出现问题。

无法获取类型为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 的对象的未知属性 'implementation'。


注:此内容涉及 Gradle 在 Android 开发中的使用,错误信息提示无法获取 implementation 属性。
    apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.loganwiley.findmyphone"
        minSdkVersion 17
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        compileKotlin {
            kotlinOptions.suppressWarnings = true
        }

        compileKotlin {
            kotlinOptions {
                suppressWarnings = true
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'+
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'+
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'+
    implementation 'com.google.firebase:firebase-auth:10.2.4'+
    implementation 'com.google.firebase:firebase-database:10.2.4'+
    implementation 'com.google.android.gms:play-services-maps:10.2.4'+
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'+
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'+
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
repositories {
    mavenCentral()
}

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

可能重复:https://dev59.com/xlkS5IYBdhLWcg3w8ae- - Robb
1个回答

0

移除所有依赖声明后面的奇怪加号(+)。例如,改为:

implementation 'com.android.support:appcompat-v7:28.0.0'+

请编写:

implementation 'com.android.support:appcompat-v7:28.0.0'

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接