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 a configuration with name 'testCompile' as a configuration with that name already exists #42

Closed
rallat opened this Issue Sep 8, 2014 · 6 comments

Comments

Projects
None yet
4 participants
@rallat

rallat commented Sep 8, 2014

I am getting this error when I add this line to my build.gradle after android {} block

apply plugin: 'android-unit-test'

This is the debug error:

19:40:40.016 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.InvalidUserDataException: Cannot add a configuration with name 'testCompile' as a configuration with that name already exists.
19:40:40.016 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.DefaultNamedDomainObjectCollection.assertCanAdd(DefaultNamedDomainObjectCollection.java:95)
19:40:40.016 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:56)
19:40:40.017 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:40)
19:40:40.017 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.NamedDomainObjectContainer$create.call(Unknown Source)
19:40:40.017 [ERROR] [org.gradle.BuildExceptionReporter]    at com.jcandksolutions.gradle.androidunittest.ConfigurationManager.createTestCompileTaskConfiguration(ConfigurationManager.groovy:36)
19:40:40.018 [ERROR] [org.gradle.BuildExceptionReporter]    at com.jcandksolutions.gradle.androidunittest.ConfigurationManager.createNewConfigurations(ConfigurationManager.groovy:32)
19:40:40.018 [ERROR] [org.gradle.BuildExceptionReporter]    at com.jcandksolutions.gradle.androidunittest.ConfigurationManager$createNewConfigurations.call(Unknown Source)
19:40:40.018 [ERROR] [org.gradle.BuildExceptionReporter]    at com.jcandksolutions.gradle.androidunittest.MainHandler.run(MainHandler.groovy:24)
19:40:40.019 [ERROR] [org.gradle.BuildExceptionReporter]    at com.jcandksolutions.gradle.androidunittest.MainHandler$run.call(Unknown Source)
19:40:40.019 [ERROR] [org.gradle.BuildExceptionReporter]    at com.jcandksolutions.gradle.androidunittest.AndroidUnitTestPlugin.apply(AndroidUnitTestPlugin.groovy:23)
19:40:40.019 [ERROR] [org.gradle.BuildExceptionReporter]    at com.jcandksolutions.gradle.androidunittest.AndroidUnitTestPlugin.apply(AndroidUnitTestPlugin.groovy)
19:40:40.020 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:104)
19:40:40.020 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)
19:40:40.020 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)
19:40:40.020 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:116)
19:40:40.021 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
19:40:40.021 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:85)
19:40:40.021 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:129)
19:40:40.021 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:41)
19:40:40.022 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.Project$apply.call(Unknown Source)
19:40:40.022 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
19:40:40.022 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.Script$apply.callCurrent(Unknown Source)
19:40:40.023 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
19:40:40.023 [ERROR] [org.gradle.BuildExceptionReporter]    ... 56 more

Any idea how can I fix this?
Thanks

@rallat

This comment has been minimized.

Show comment
Hide comment
@rallat

rallat Sep 8, 2014

My bad. I was using a gradle plugin that declared testCompile already. Removing that plugin fixes the issue. Thanks for the plugin!

rallat commented Sep 8, 2014

My bad. I was using a gradle plugin that declared testCompile already. Removing that plugin fixes the issue. Thanks for the plugin!

@rallat rallat closed this Sep 8, 2014

@SuperJugy

This comment has been minimized.

Show comment
Hide comment
@SuperJugy

SuperJugy Sep 8, 2014

Collaborator

Ok. No problem.

Collaborator

SuperJugy commented Sep 8, 2014

Ok. No problem.

@SuperJugy SuperJugy added invalid wontfix and removed wontfix labels Sep 8, 2014

@sneuberger-amazon

This comment has been minimized.

Show comment
Hide comment
@sneuberger-amazon

sneuberger-amazon Dec 10, 2014

I'm getting this error when using Studio/Gradle 1.0.0. The only gradle plugins I'm using are "com.android.library" and "android".

Is it possible that gradle 1.0.0 release added a testCompile configuration (although I can't find any mention of it in the android docs)? Can anyone confirm if this plugin is working with Android Studio 1.0?

sneuberger-amazon commented Dec 10, 2014

I'm getting this error when using Studio/Gradle 1.0.0. The only gradle plugins I'm using are "com.android.library" and "android".

Is it possible that gradle 1.0.0 release added a testCompile configuration (although I can't find any mention of it in the android docs)? Can anyone confirm if this plugin is working with Android Studio 1.0?

@SuperJugy

This comment has been minimized.

Show comment
Hide comment
@SuperJugy

SuperJugy Dec 10, 2014

Collaborator

Gradle is 2.2.1, android plugin is 1.0.0-rc4 and android studio is 1.0.0 and it is working as intended for me.

Collaborator

SuperJugy commented Dec 10, 2014

Gradle is 2.2.1, android plugin is 1.0.0-rc4 and android studio is 1.0.0 and it is working as intended for me.

@aarushi24

This comment has been minimized.

Show comment
Hide comment
@aarushi24

aarushi24 Jun 19, 2015

I'm getting the same problem. How do I find this plugin?

aarushi24 commented Jun 19, 2015

I'm getting the same problem. How do I find this plugin?

@SuperJugy

This comment has been minimized.

Show comment
Hide comment
@SuperJugy

SuperJugy Jun 19, 2015

Collaborator

If you mean, how do you find the duplicate plug in, thne just remove one plugin at a time and see what happens. But in any case, this plugin is deprecated and should not be used with the latest android plugin.

Collaborator

SuperJugy commented Jun 19, 2015

If you mean, how do you find the duplicate plug in, thne just remove one plugin at a time and see what happens. But in any case, this plugin is deprecated and should not be used with the latest android plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment