执行我的代码时出现以下错误:com.squareup.leakcanary:leakcanary-android:1.5

I am getting the following error while executing my code : com.squareup.leakcanary:leakcanary-android:1.5

我在执行代码时遇到以下错误。

Error: Could not find method debugdcompile() for arguments [com.squareup.leakcanary:leakcanary-android:1.5] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

在app.gradle

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'

mavenCentral()jcenter 一起添加到 build.gradle 中的 allprojects 部分。

这可能有助于解决问题。

你写的是debugdcompile,这是错误的。应该是debugCompile。 C 必须大写,d 甚至不应该在那里