Gradle Android, eliminate dependency on another module

I have an android app that I want unit test. With the MVP template, I managed to extract many classes outside the “Android world” to test them as simple unit tests (with Junit) inside a separate module [1]. However, I would like to write some posts from these classes. So I tried using slf4j-apiandroid bound. With the intention of providing a simple binding to my tests. But the test module starts by complaining about the presence of two slf4j bindings in the classpath and that it uses the android binding.

So my question is: how can I eliminate the dependency slf4j-androidfrom the test module ? Here is a build.gradle example of my test module

evaluationDependsOn(":app")

apply plugin: 'java'

dependencies {
    def app = project(':app')

    testCompile project(path: ':app', configuration: 'debugCompile')

    def debugVariant = app.android.applicationVariants.find({it.name == 'debug'})
    testCompile debugVariant.javaCompile.classpath
    testCompile debugVariant.javaCompile.outputs.files
    testCompile files(app.plugins.findPlugin("com.android.application").getBootClasspath())

    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    testCompile 'org.powermock:powermock-api-mockito:1.6.1'
    testCompile 'org.assertj:assertj-core:1.7.1'

}

[1] http://blog.blundell-apps.com/how-to-run-robolectric-junit-tests-in-android-studio/

+4
1

"" . - :

testCompile 'junit: junit: 4.12' {    'slf4j-android' }

, . , gradle .

gradle

0

All Articles