首页 文章

Android:如何使用支持25.0.0的Espresso 2.2.2?

提问于
浏览
2

我怎样才能使这个工作?我读了很多类似的策略,唉 . 使用高于23.1.1的支持库会一次又一次失败 .

dependencies {
  compile 'com.android.support:design:25.0.0'
  compile 'com.android.support:support-v4:25.0.0'
  compile files('libs/slf4j-android-1.5.8.jar')
  androidTestCompile 'com.android.support:support-annotations:25.0.0'
  androidTestCompile( 'com.android.support.test:rules:0.5')
  androidTestCompile( 'com.android.support.test.espresso:espresso-contrib:2.2.2')
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
 })
}

我收到了这条消息:

警告:与依赖项冲突'com.android.support:recyclerview-v7' . app(25.0.0)和测试app(23.1.1)的已解决版本有所不同 . 有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict . 警告:与依赖项冲突'com.android.support:support-v4' . app(25.0.0)和测试app(23.1.1)的已解决版本有所不同 . 有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict . 警告:与依赖项冲突'com.android.support:appcompat-v7' . app(25.0.0)和测试app(23.1.1)的已解决版本有所不同 . 有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict . 警告:与依赖性冲突'com.android.support:design' . app(25.0.0)和测试app(23.1.1)的已解决版本有所不同 . 有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict .

STEP 1 :我尝试使用排除组...没有用 .

STEP 2 :我也尝试过不同的策略:configurations.all {resolutionStrategy {force 'com.android.support:support-annotations:23.1.1'}}

STEP 3 :当然我试过第一个gradlew:app:dependenices等,但是那个一直在崩溃 . 是的,我使用的是JDK1.8 . 这是一个注册的bug,自夏天以来一直没有解决 .

顺便说一下... Android,支持包和Espresso都来自谷歌?

1 回答

  • 11

    尝试

    dependencies {
      compile 'com.android.support:design:25.0.0'
      compile 'com.android.support:support-v4:25.0.0'
      compile files('libs/slf4j-android-1.5.8.jar')
      androidTestCompile 'com.android.support:support-annotations:25.0.0'
      androidTestCompile('com.android.support.test:rules:0.5') {
                   exclude module: 'support-annotations'
      }
      androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2') {
                   exclude module: 'espresso-core'
                   exclude module: 'support-v4'
                   exclude module: 'recyclerview-v7'
                   exclude module: 'appcompat-v7'
                   exclude module: 'support-annotations'
                   exclude module: 'design'
      }
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
                   exclude module: 'rules'
                   exclude module: 'javax.annotation-api'
                   exclude module: 'support-annotations'
      }
    

    's my working setup - you essentially exclude support annotations from all Espresso dependencies and let them use the one that'已从标准运行时依赖项中解析出来 . 其他一些依赖项给我带来了麻烦,所以我只是将它们排除在外,让构建从显式 compile 语句中解析它们 .

相关问题