Android tests build error: Multiple dex files define Landroid/support/test/BuildConfig

前端 未结 7 2353
逝去的感伤
逝去的感伤 2020-12-01 05:02

I\'m trying to add Espresso 2 to my project (which also has lots of other dependencies), but I\'m hitting this error when trying to run tests:

UNEXPECTED TOP         


        
7条回答
  •  孤街浪徒
    2020-12-01 05:13

    According to this bug report, you can also use resolutionStrategy:

    allprojects {
        repositories {
            mavenCentral()
            maven {
                url 'http://download.crashlytics.com/maven'
            }
        }
        configurations.all {
            resolutionStrategy.force 'com.android.support:support-annotations:22.2.0'
        }
    }
    

    This is the solution that worked for me and allowed me to use the most recent version of appcompat-v7 and appcompat-v4.

提交回复
热议问题