0

我刚刚将我的 android studio 更新到最后一个版本,即 3.3.5,但是 当我Gradle DSL method not found: 'compile()' Possible causes: 试图将 apdf 视图添加到我的项目时,我真的遇到了这个问题。知道我也已经有了最新版本的 gradle。但它仍然表明我应该更新我的抓斗。

The project 'test' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.3 and sync project

'''

The project 'test' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file

The build file may be missing a Gradle plugin.
Apply Gradle plugin

我认为这是因为源代码从编译开始,但我该如何替换它。

4

2 回答 2

1

要将 Gradle 插件更新到 3.5.3:

在您的顶级build.gradle文件中:

buildscript {
    //...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        //...
    }
}

使用compile()方法修复错误:

在您的模块级build.gradle 中,将compile()替换为implementation(),如下所示:

compile 'com.somelibrary:somelibrary:1.0'
// with
implementation 'com.somelibrary:somelibrary:1.0'

testCompile 'com.sometestlibrary:sometestlibrary:1.0'
// with
testImplementation 'com.sometestlibrary:sometestlibrary:1.0'
于 2019-12-23T12:23:44.707 回答
0

更新您的 gradle 插件以及 gradle 包装器版本,如 URL https://developer.android.com/studio/releases/gradle-plugin中所述

于 2019-12-23T12:15:31.850 回答