标记ignoreFailures会在任务connectedAnd

标记ignoreFailures会在任务connectedAnd

本文介绍了android-gradle-plugin 1.2.2:标记ignoreFailures会在任务connectedAndroidTest中导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新了我的build.gradle以使用android-gradle插件1.2.2(而不是1.1.0):

 依赖关系{
classpath'com.android.tools.build:gradle:1.2.2'
}

之后,如果我尝试同步我的项目,我会得到一个异常。
我的build.gradle

  apply plugin:'com.android.application'

android {

packagingOptions {
exclude'LICENSE.txt'
}

compileSdkVersion 22
buildToolsVersion22.0.1

defaultConfig {
applicationIdcom.kupferwerk.myapplication
minSdkVersion 15
targetSdkVersion 22
versionCode 100
versionName1.0.0
}
lintOptions {
abortOnError false
禁用'ContentDescription'
禁用'InvalidPackage'
}

buildTypes {
release {
minifyEnabled false
proguardFiles'proguard-rules.pro'
}
debug {
applicationIdSuffix.debug
testCoverageEnabled true
}
}
}



project.gradle.taskGraph.whenReady {
connectedAndroidTest {
ignoreFailures = true
}
}

错误是

 错误:(58)没有这样的属性:ignoreFailures类:org.gradle.api.DefaultTask_Decorated 

在我的build.gradle文件的这一部分内:

  project.gradle.taskGraph.whenReady {
connectedAndroidTest {
ignoreFailures = true
}
}

有人知道标志 ignoreFailures 是否被删除或重命名了吗?如何解决这个问题?



编辑:这是堆栈跟踪:

  groovy.lang.MissingPropertyException:没有这样的属性:ignoreFailures类:org.gradle.api.DefaultTask_Decorated 
在org.gradle.api.internal.plugins.ExtraPropertiesDynamicObjectAdapter.setProperty ExtraPropertiesDynamicObjectAdapter.java:46)
at org.gradle.api.internal.CompositeDynamicObject.setProperty(CompositeDynamicObject.java:119)
at org.gradle.api.DefaultTask_Decorated.setProperty(Unknown Source)
在build_bbosu6ukmbcd6hf72mh10z6fq $ _run_closure3_closure14.doCall(/Users/chsc/Development/MyApplication/app/build.gradle:58)
在org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:63)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:110)
在org.gradle.api .internal.AbstractTask.configure(A bstractTask.java:482)
在org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:58)
在org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java: 55)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
在org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)
在org .gradle.api.internal.DefaultNamedDomainObjectCollection $ ContainerElementsDynamicObject.invokeMethod(DefaultNamedDomainObjectCollection.java:324)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
at org.gradle .groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
at build_bbosu6ukmbcd6hf72mh10z6fq $ _run_closure3.doCall(/Users/chsc/Development/MyApplication/app/build.gradle:57)
at org。 gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodIn在org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java: 31)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter $ DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy。$ Proxy9.graphPopulated(Unknown Source)


解决方案

随着gradle-plugin 1.3.0的发布,任务的名称已再次更改:

  project.gradle.taskGraph.whenReady {
connectedDebugAndroidTest {
ignoreFailures = true


编辑:来自StefanTo的不错提示:


$ b $

具体来说:连接[YourFlavor] [Debug] AndroidTest


I updated my build.gradle to use android-gradle plugin 1.2.2 (instead of 1.1.0):

dependencies {
    classpath 'com.android.tools.build:gradle:1.2.2'
}

Afterwards I get an exception, if I try to sync my project.My build.gradle

apply plugin: 'com.android.application'

android {

   packagingOptions {
      exclude 'LICENSE.txt'
   }

   compileSdkVersion 22
   buildToolsVersion "22.0.1"

   defaultConfig {
      applicationId "com.kupferwerk.myapplication"
      minSdkVersion 15
      targetSdkVersion 22
      versionCode 100
      versionName "1.0.0"
   }
   lintOptions {
      abortOnError false
      disable 'ContentDescription'
      disable 'InvalidPackage'
   }

   buildTypes {
      release {
         minifyEnabled false
         proguardFiles 'proguard-rules.pro'
      }
      debug {
         applicationIdSuffix ".debug"
         testCoverageEnabled true
      }
   }
}



project.gradle.taskGraph.whenReady {
   connectedAndroidTest {
      ignoreFailures = true
   }
}

The error is

Error:(58) No such property: ignoreFailures for class: org.gradle.api.DefaultTask_Decorated

within this section of my build.gradle-file:

project.gradle.taskGraph.whenReady {
   connectedAndroidTest {
      ignoreFailures = true
   }
}

Does anybody know if the flag ignoreFailures was removed or renamed? How could I solve this problem?

Edit: This is the stacktrace:

groovy.lang.MissingPropertyException: No such property: ignoreFailures for class: org.gradle.api.DefaultTask_Decorated
    at org.gradle.api.internal.plugins.ExtraPropertiesDynamicObjectAdapter.setProperty(ExtraPropertiesDynamicObjectAdapter.java:46)
    at org.gradle.api.internal.CompositeDynamicObject.setProperty(CompositeDynamicObject.java:119)
    at org.gradle.api.DefaultTask_Decorated.setProperty(Unknown Source)
    at build_bbosu6ukmbcd6hf72mh10z6fq$_run_closure3_closure14.doCall(/Users/chsc/Development/MyApplication/app/build.gradle:58)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:63)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:110)
    at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:482)
    at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:58)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:55)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)
    at org.gradle.api.internal.DefaultNamedDomainObjectCollection$ContainerElementsDynamicObject.invokeMethod(DefaultNamedDomainObjectCollection.java:324)
    at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
    at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
    at build_bbosu6ukmbcd6hf72mh10z6fq$_run_closure3.doCall(/Users/chsc/Development/MyApplication/app/build.gradle:57)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
    at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)
    at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy9.graphPopulated(Unknown Source)
解决方案

With the release of gradle-plugin 1.3.0 the name of the task has been changed again:

project.gradle.taskGraph.whenReady {
   connectedDebugAndroidTest {
      ignoreFailures = true
   }
}

EDIT: Nice hint from StefanTo:

To be more specific: connected[YourFlavor][Debug]AndroidTest

这篇关于android-gradle-plugin 1.2.2:标记ignoreFailures会在任务connectedAndroidTest中导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 20:42