首页 > 解决方案 > Gradle 方法未找到:'compile' 可能的原因:项目

问题描述

在此处输入图像描述

dependencies {
        classpath 'com.android.tools.build:gradle:3.5.2'


        compile 'com.android.support:appcompat-v7:24.1.1'
        compile 'com.android.support:design:24.1.1'


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

我正在尝试将编译方法添加到 build.gradle 但我遇到了这个问题我有 android studio 3.5.2

和 5.4.1 gradle

标签: javaandroidandroid-studiobuild.gradle

解决方案


您可以替换compileimplementation

implementation 'com.android.support:appcompat-v7:24.1.1'
implementation 'com.android.support:design:24.1.1'

但是您将依赖项放入build.gradle模块项目中。将它们放在build.gradle模块应用程序中。


推荐阅读