Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add task as a task with that name already exists. #16

Closed
xgouchet opened this issue Jan 19, 2016 · 4 comments
Closed

Cannot add task as a task with that name already exists. #16

xgouchet opened this issue Jan 19, 2016 · 4 comments

Comments

@xgouchet
Copy link

Hi,
I've got a project with multiple flavor dimensions, meaning that I have a lot of different combination.
I have a dimension for the package name (beta / pro / ...) and a dimension for the target play store (Google, amazon, ...)

When I add apply plugin: 'jacoco-android' in my build.gradle, any gradle task gives this exception :

org.gradle.api.InvalidUserDataException: Cannot add task ':app:jacocoTestBetaGooglePlayStoreDebugUnitTestReport' as a task with that name already exists.
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:74)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:97)
at com.dicedmelon.gradle.jacoco.android.JacocoAndroidPlugin.createReportTask(JacocoAndroidPlugin.groovy:67)
at com.dicedmelon.gradle.jacoco.android.JacocoAndroidPlugin$_apply_closure1.doCall(JacocoAndroidPlugin.groovy:32)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:165)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:159)
at com.android.build.gradle.AppExtension.addVariant(AppExtension.java:47)
at com.android.build.gradle.internal.ApiObjectFactory.create(ApiObjectFactory.java:113)
at com.android.build.gradle.BasePlugin$12.call(BasePlugin.java:654)
at com.android.build.gradle.BasePlugin$12.call(BasePlugin.java:647)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:646)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:566)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:563)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:562)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:559)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
... 52 more

@arturdm
Copy link
Owner

arturdm commented Jan 20, 2016

Hi @xgouchet,
can you specify which versions of:

  • Gradle (or Gradle wrapper version)
  • Android Gradle plugin (e.g. 'com.android.tools.build:gradle:1.5.0')

do you use in your project?

Am I right that this is more or less the content of your android {} flavors configuration:

flavorDimensions 'package', 'target'

productFlavors {
  beta {
    dimension 'package'
  }
  pro {
    dimension 'package'
  }
  googlePlayStore {
    dimension 'target'
  }
  amazon {
    dimension 'target'
  }
}

?

@xgouchet
Copy link
Author

Hi,

yes this is how my flavors are configured. I'm using gradle wrapper 2.9, and Android Gradle plugin 1.5.0

@arturdm
Copy link
Owner

arturdm commented Jan 20, 2016

@xgouchet I couldn't reproduce your problem with this setup:
https://github.com/arturdm/example-android/blob/feature/test-ci/sample-app/build.gradle

Can you post a little project or modify my example so it fails for you with this error?

@arturdm
Copy link
Owner

arturdm commented Mar 30, 2016

@xgouchet I'm closing this issue for now. If you still have issues with the plugin please provide additional information.

@arturdm arturdm closed this as completed Mar 30, 2016
@arturdm arturdm reopened this May 27, 2017
arturdm pushed a commit that referenced this issue May 27, 2017
arturdm added a commit that referenced this issue May 27, 2017
arturdm added a commit that referenced this issue May 27, 2017
Fix improper test task searching

Fixes #16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants