首页 > 解决方案 > 错误:未找到 Gradle DSL 方法:'implementation()' 但我有最新的 Android Studio,gradle,

问题描述

我只想执行'de.hdodenhof:circleimageview:3.0.0'使图像变圆。但我不能

我尝试更新所有内容

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        implementation 'de.hdodenhof:circleimageview:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

标签: androidandroid-studio

解决方案


您编辑了错误的build.gradle文件。您添加的正下方的行警告您不要这样做:

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

如果您有一个典型的 Android Studio 项目,请将您的项目implementation 'de.hdodenhof:circleimageview:3.0.0'从您拥有的位置移至文件中的dependencies闭包app/build.gradle


推荐阅读