Anybody got `No such property: UNIT_TEST for class...
# android
d
Anybody got
No such property: UNIT_TEST for class: com.android.builder.core.VariantType
when updating to AS 3.2 with gradle 4.7 and junitPlatform during Gradle configuration step?
Copy code
Caused by: groovy.lang.MissingPropertyException: No such property: UNIT_TEST for class: com.android.builder.core.VariantType
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnit5Test$ConfigAction.getDefaultUnitTestTask(AndroidJUnit5Test.groovy:206)
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnit5Test$ConfigAction.configureTaskDependencies(AndroidJUnit5Test.groovy:185)
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnit5Test$ConfigAction.execute(AndroidJUnit5Test.groovy:100)
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnit5Test$ConfigAction.execute(AndroidJUnit5Test.groovy)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:252)
        at org.gradle.api.tasks.TaskContainer$create.call(Unknown Source)
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnit5Test.create(AndroidJUnit5Test.groovy:55)
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnitPlatformPlugin$_configureTasks_closure8.doCall(AndroidJUnitPlatformPlugin.groovy:205)
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnitPlatformPlugin.configureTasks(AndroidJUnitPlatformPlugin.groovy:204)
        at de.mannodermaus.gradle.plugins.android_junit5.AndroidJUnitPlatformPlugin$_apply_closure1.doCall(AndroidJUnitPlatformPlugin.groovy:64)
        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
        at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
        at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
        at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
        at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
        at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
        at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy26.afterEvaluate(Unknown Source)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)
        ... 85 more
u
In case you haven't solved this already: you need to update your Android JUnit 5 plugin (the mannodermaus thing)
d
I did, it still didn't help... unless I didn't do it right..? I have some tests in junit 4 and some in spek 1.x...
So I ended up downgrading from 3.2.0 to 3.1.4... but I'd love to be able to solve this one...
u
Well, I had the same error message and upgraded to the new version. I also had to adjust the build scripts a bit, but in the end I got it working.
I'm using
de.mannodermaus.gradle.plugins:android-junit5:1.2.0.0
now
my test module (which provides all the test dependencies for other modules) contains this:
Copy code
apply plugin: 'java'
    apply plugin: 'kotlin'
    apply plugin: 'java-library'
    ....
    api "org.junit.jupiter:junit-jupiter-api:5.2.0"
    api "org.junit.jupiter:junit-jupiter-params:5.2.0"
    api "junit:junit:4.12"
    api "org.junit.vintage:junit-vintage-engine:5.2.0"

    runtime "org.junit.jupiter:junit-jupiter-engine:5.2.0"
    runtime "org.junit.platform:junit-platform-launcher:1.2.0"
the test module is included in other projects like this:
testImplementation project(':libtest')
d
I tried 1.2.0.0 but the ide couldn't find it on mavenCentral or jcenter... I'll check again against the exact dep you have, maybe they changed the package name or something... Does this config work with spek 1.x too?
u
I don't use spek, but junit4 works
also in every android module that contains tests you will need the
apply plugin: "de.mannodermaus.android-junit5
at the top
👍🏼 1
d
Thanks for the pointers, I'll see if that helps 🙂
u
You're welcome. I hope you'll sort it out. Being stuck on < 3.2 sucks 😄