无法为LeakCanary库构建Gradle

时间:2015-05-25 09:48:49

标签: android gradle leakcanary

我尝试构建Gradle:

  

执行命令:" - stacktrace"

     

失败:构建因异常而失败。

     
      
  • 其中:   构建文件' H:\ Nin_in_the_winD \ working.space \ development \ branch \ eazy \ build.gradle' line:2

  •   
  • 出了什么问题:   评估根项目' eazy'

    时出现问题      
        

    无法在根项目' eazy'上找到参数[com.squareup.leakcanary:leakcanary-android:1.3.1@aar]的方法debugCompile()。

      
  •   
  • 尝试:   使用--info或--debug选项运行以获得更多日志输出。

  •   
  • 例外情况是:   org.gradle.api.GradleScriptException:评估根项目' eazy'时出现问题。   在org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory $ ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:76)   at org.gradle.configuration.DefaultScriptPluginFactory $ ScriptPluginImpl $ 1.run(DefaultScriptPluginFactory.java:148)   at org.gradle.configuration.DefaultScriptPluginFactory $ ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)   在org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)   在org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)   在org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)   在org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)   在org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)   在org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:85)   在org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)   在org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)   在org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)   在org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)   在org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)   at org.gradle.launcher.exec.InProcessBuildActionExecuter $ DefaultBuildController.run(InProcessBuildActionExecuter.java:90)   在org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)   在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)   at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)   at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)   在org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:50)   在org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:27)   在org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)   在org.gradle.internal.Actions $ RunnableActionAdapter.execute(Actions.java:169)   在org.gradle.launcher.cli.CommandLineActionFactory $ ParseAndBuildAction.execute(CommandLineActionFactory.java:237)   在org.gradle.launcher.cli.CommandLineActionFactory $ ParseAndBuildAction.execute(CommandLineActionFactory.java:210)   在org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)   在org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)   在org.gradle.launcher.cli.CommandLineActionFactory $ WithLogging.execute(CommandLineActionFactory.java:206)   在org.gradle.launcher.cli.CommandLineActionFactory $ WithLogging.execute(CommandLineActionFactory.java:169)   在org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)   在org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)   在org.gradle.launcher.Main.doAction(Main.java:33)   在org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)   在org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)   在org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)   在org.gradle.launcher.GradleMain.main(GradleMain.java:23)   引起:org.gradle.api.internal.MissingMethodException:找不到根项目中参数[com.squareup.leakcanary:leakcanary-android:1.3.1@aar]的方法debugCompile()' eazy' 。   at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)   at org.gradle.api.internal.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:56)   在org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:175)   在org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)   在build_4cypqr1onvufm2h2phqvhowz7 $ _run_closure1.doCall(H:\ Nin_in_the_winD \ working.space \ development \ branch \ eazy \ build.gradle:2)   在org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)   在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)   在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)   在org.gradle.api.internal.project.AbstractProject.dependencies(AbstractProject.java:838)   at org.gradle.api.internal.BeanDynamicObject $ MetaClassAdapter.invokeMethod(BeanDynamicObject.java:232)   在org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:127)   at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:150)   在org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)   在build_4cypqr1onvufm2h2phqvhowz7.run(H:\ Nin_in_the_winD \ working.space \ development \ branch \ eazy \ build.gradle:1)   在org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory $ ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:74)   ......还有35个

  •   

这是我的gradle.build:

dependencies {
  debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1@aar'
  releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1@aar'
}
repositories {
  mavenCentral()
}

1 个答案:

答案 0 :(得分:1)

Nin我认为你需要'编译'默认行,在你的依赖项中添加这一行:

compile fileTree(dir: 'libs', include: ['*.jar'])

如果你可以修复你的错误,请告诉我!祝你好运!