Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add a configuration with name 'testCompile' as a configuration with that name already exists

When updating to gradle plugin 1.1.0 I kept getting the following error

Cannot add a configuration with name 'testCompile' as a configuration with that name already exists

I am also using the Robolectric gradle plugin from here, v0.14.0.

The new gradle 1.1.0 plugin adds additional unit test support, so I suspect the gradle and Robolectric plugins are battling for use of 'testCompile,' though I'm not sure how to resolve this.

like image 277
Kio Krofovitch Avatar asked Feb 25 '15 21:02

Kio Krofovitch


1 Answers

To fix that issue i did the following:

Added the following to my build gradle script:

 apply plugin: 'org.robolectric'

 dependencies {
    classpath 'org.robolectric:robolectric-gradle-plugin:1.0.0'
 }

This wouldnt work for me with gradle version 1.1.0 though. I had to use 1.1.0-rci which is still only in experimental phase. So i added the following to my project build.gradle:

  dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0-rc1'
}

Ran sync project with gradle files and the issue was corrected. Hope this helps.

like image 53
sirFunkenstine Avatar answered Nov 03 '22 00:11

sirFunkenstine