robolectric/robolectric-gradle-plugin

Could not find property 'outputs' with 0.13.2

fouady opened this issue · 8 comments

Hi, I see there is a new version of robolectric plugin on maven central. I try to sync my project using this version but Android Studio gives me this error:

Error:Could not find property 'outputs' on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@4c5d03c5.

Please note that I'm using JDK7 and 0.13.0 works well, 0.13.1 gives the unsupported major.minor error (plugin built using JDK8), and 0.13.2 gives this problem.

I'm getting this:

15:37:56.897 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: groovy.lang.MissingPropertyException: Could not find property 'outputs' on com.android.build.gradle.internal.api.LibraryVariantImpl_Decorated@1f783c7e.
15:37:56.897 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
15:37:56.897 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
15:37:56.897 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:94)
15:37:56.898 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.api.LibraryVariantImpl_Decorated.getProperty(Unknown Source)
15:37:56.898 [ERROR] [org.gradle.BuildExceptionReporter]    at org.robolectric.gradle.RobolectricPlugin$_apply_closure1.doCall(RobolectricPlugin.groovy:62)

when trying to run ./gradlew clean test on my project on 0.13.2. If I downgrade to 0.13.0 it works correctly.

To me it seems this happened after this particular commit: ec26557

Not sure though.

What version of com.android.tools.build:gradle are you referencing in the buildscript section of your build.gradle? The 0.13.x versions of this plugin are targeting the 0.13.x versions of the Android Gradle plugin. So there could be errors (like the one you are talking about) when you try to use robolectric-gradle-plugin 0.13.x with Android Gradle plugin 0.12.x

That may be the cause then. I'm referencing com.android.tools.build:gradle:0.12.+. I would strongly advise you update the README Basic Usage to mention that the version numbering on this project maps through to the versions of com.android.tools.build:gradle. It's really misleading otherwise, and the potential bugs that can result are non-obvious that this is the case.

erd commented

The readme has a section titled 'Compatibility' which describes which version of the android gradle plugin it is compatible with. If there was a way to programmatically determine the version number of the android plugin, I'd be happy to add runtime checks since this tends to trip people up.

The compatibility section isn't saying anything about backwards-compatibility though, which is the underlying problem here. The fact that I can't use 0.13.2 on gradle 0.12.x isn't mentioned, hinted or otherwise revealed.

Changing android gradle plugin version to 0.13.2 worked :)

erd commented

Checking the version of the gradle plugin at runtime should help with prevent this in the future.