Espresso Library版本与Android版本23.1.1+不兼容

时间:2016-07-06 07:03:09

标签: java android automated-tests android-espresso

以下版本的Espresso库 NOT 与Android 23.1.1以上版本兼容:

  1. 'com.android.support.test.espresso:浓咖啡的contrib:2.2.2'
  2. 'com.android.support.test.espresso:浓咖啡的web:2.2.2'
  3. 'com.android.support.test.espresso:浓咖啡怠速资源:2.2.2'
  4. 因此,我无法使用导致此错误的“com.android.support:support-v4:23.1.1”之上的任何内容:enter image description here

    导入的文件

    import com.google.android.gms.location.places.PlacePhotoMetadata;
    import com.google.android.gms.location.places.PlacePhotoMetadataBuffer;
    import com.google.android.gms.location.places.PlacePhotoMetadataResult;
    import com.google.android.gms.location.places.Places;
    

    如果有人有解决方法可以解决这个问题,请帮助我。

1 个答案:

答案 0 :(得分:0)

以下配置有效:

defaultConfig {
    // ...
    testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
    //compile "com.android.support:cardview-v7:23.1.1"
    //compile "com.android.support:design:23.1.1"
    compile "com.android.support:recyclerview-v7:23.1.1" //THIS IS REQUIRED!
    compile "com.android.support:support-v4:23.1.1"

    // Unit Tests
    testCompile 'junit:junit:4.12'
    testCompile "org.mockito:mockito-all:1.10.19"
    testCompile "org.hamcrest:hamcrest-all:1.3"
    testCompile "org.powermock:powermock-module-junit4:1.6.2"
    testCompile "org.powermock:powermock-api-mockito:1.6.2"

    // Espresso Idling Resource
    compile "com.android.support.test.espresso:espresso-idling-resource:2.2.1"

    // Android Testing Support Library's runner and rules
    androidTestCompile "com.android.support.test:runner:0.4.1"
    androidTestCompile "com.android.support.test:rules:0.4.1"

    // Espresso UI Testing dependencies.
    androidTestCompile("com.android.support.test.espresso:espresso-core:2.2.1") {
        exclude group: 'javax.inject'
    }
    androidTestCompile("com.android.support.test.espresso:espresso-contrib:2.2.1") {
        exclude group: 'javax.inject'
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude module: 'recyclerview-v7'
    }
    androidTestCompile "com.android.support.test.espresso:espresso-intents:2.2.1"
}

configurations.all {
    resolutionStrategy.force "com.android.support:support-annotations:23.1.1"
}

configurations.compile.dependencies.each { compileDependency ->
    println "Excluding compile dependency: ${compileDependency.getName()}"
    configurations.androidTestCompile.dependencies.each { androidTestCompileDependency ->
        configurations.androidTestCompile.exclude module: "${compileDependency.getName()}"
    }
}

请尝试将2.2.1更改为2.2.2仍然有效。

现在我再次查看了您的问题,我认为您的问题是google play services版本,而不是支持库版本。