Using android gradle + dagger to run instrumentTests

前端 未结 2 415
长发绾君心
长发绾君心 2021-02-06 11:24

I have began using Android Studio and gradle recently for android development and find it much better overall than eclipse/ant or maven. However I\'ve recently began trying to i

2条回答
  •  情歌与酒
    2021-02-06 11:56

    Ok, so I have been dealing with this problem for hours, and here is my fix: Put this in the dependencies of your build.gradle

    compile(project(':commons:statemachine')) {
        exclude module: 'junit'
        exclude module: 'json'
        exclude module: 'guava'
    }
    
    compile 'com.google.guava:guava:15.0'
    instrumentTestCompile files('libs/espresso-1.0-SNAPSHOT-bundled.jar')
    instrumentTestCompile 'com.squareup:fest-android:1.0.+'
    

    Add the espresso bundled jar in the libs folder of your test. Now comes the important part.

    Open that espresso bundled jar with WinRar or equivalent and go to com/ folder, then select de android folder and Delete it. Now close WinRar and compile and run your test :-)

提交回复
热议问题