首页 > 解决方案 > 如何修复错误 Gradle DSL 方法未找到:'compile()'?

问题描述

我正在尝试将 google play 计费库与我的 android 应用程序集成,并且当我尝试 (compile 'com.android.billingclient:billing:1.0') 在应用程序模块的build.gradle文件中添加此依赖项时。我收到以下错误:

ERROR: Gradle DSL method not found: 'compile()'

Possible causes:
The project 'work' 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.4.1 and sync project

The project 'work' 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

任何人都可以帮忙吗?

已经谢谢了。

标签: androidandroid-studioandroid-gradle-pluginbuild.gradle

解决方案


转到Build.gradle(Module:App)

图片

dependencies {
    implementation 'com.android.billingclient:billing:1.0'
}

推荐阅读