android-gradle-plugin 1.2.2: Flag ignoreFailures c

2019-02-26 11:14发布

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)

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-26 11:44

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

查看更多
beautiful°
3楼-- · 2019-02-26 11:53

Try to use:

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

To be more specific: connectedAndroidTest[YourFlavor][Debug]

查看更多
登录 后发表回答