解决版本的应用程序(22.0.0)和测试应用程序(21.0.3)的不同 [英] Resolved versions for app (22.0.0) and test app (21.0.3) differ

查看:658
本文介绍了解决版本的应用程序(22.0.0)和测试应用程序(21.0.3)的不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到22 API,支持lib目录的修订22,我发现了以下警告后:

  

警告:与冲突依赖   com.android.support:support-annotations。解决版本的应用程序   (22.0.0)和测试应用程序(21.0.3)是不同的。

摇篮本身就比较宽容,但Android的工作室,没有这么多。

我有21.0.3声明没有依赖关系......是使用21.0.3的依赖库之一,谷歌忘了与该批次的其他人呢?

更新

我的 build.gradle 与演员切出

 安卓{
  compileSdkVersion 22
  buildToolsVersion'22'

  defaultConfig {
    的applicationIDcom.REDACTED.android
    的minSdkVersion 14
    targetSdkVersion 22
    renderscriptSupportModeEnabled真
    VERSIONNAME1.0.0
    版本code 100
  }

  buildTypes {
    推出 {
      minifyEnabled真
      zipAlignEnabled真
      signingConfig signingConfigs.release
    }

    调试{
      minifyEnabled假
      zipAlignEnabled真
      signingConfig signingConfigs.debug
    }
  }

  依赖{
    提供org.projectlombok:龙目:1.16.2
    googleCompilecom.google.android.gms:播放服务基地:87年6月5日
    编译com.android.support:support-v4:22.0.0
    编译com.android.support:appcompat-v7:22.0.0
    编译com.android.support:support-v13:22.0.0
    编译com.android.support:cardview-v7:22.0.0
    编译com.android.support:palette-v7:22.0.0
    编译com.android.support:support-annotations:22.0.0
    编译com.github.chrisbanes.photoview:图书馆:1.2.3
    编译org.apache.commons:公地lang3:3.3.2
    编译公地IO:公地IO:2.4
    编译commons- codeC:commons- codeC:1.10
    编译com.jakewharton:butterknife:6.1.0
    编译com.jakewharton:disklrucache:2.0.2
    编译com.squareup:奥托:1.3.6
    编译com.squareup.picasso:毕加索:2.5.0
    编译com.squareup.retrofit:改造:1.9.0
    编译com.squareup.okhttp:okhttp:2.2.0
    编译com.squareup.okhttp:okhttp-的URLConnection:2.2.0
    编译com.squareup.okio:奥基奥:1.2.0
    编译com.flaviofaria:kenburnsview:1.0.6
    编译com.edmodo:栽跟头:1.0.1
    编译com.getbase:floatingactionbutton:1.8.0
    编译com.nispok:小吃店:2.10.2
    编译com.github.ksoichiro:Android的observablescrollview:1.5.0
    编译in.srain.cube:网格视图与 - 页眉页脚:1.0.9
    编译de.hdodenhof:circleimageview:1.2.2
    编译文件树(导演:库,包括:的* .jar)
    //只有测试依赖
    androidTestCompilecom.android.support.test.es preSSO:ES preSSO核心:2.0
    androidTestCompilecom.android.support.test:测试支持-lib目录下:0.1
    androidTestCompilecom.android.support.test.es preSSO:ES preSSO-的contrib:2.0
  }
 

更新:(感谢马克)

看起来像它的ES preSSO-的contrib

  + --- com.android.support.test:测试支持-lib目录下:0.1(*)
\ --- com.android.support.test.es preSSO:ES preSSO-的contrib:2.0
     + --- com.android.support:recyclerview-v7:21.0.3
     | + --- com.android.support:support-annotations:21.0.3
     | \ --- com.android.support:support-v4:21.0.3
     | \ --- com.android.support:support-annotations:21.0.3
     + --- com.android.support:support-v4:21.0.3(*)
     \ --- com.android.support.test.es preSSO:ES preSSO芯:2.0(*)
 

解决方案

在与这样的事情处理第1步是让舒适的命令行摇篮。

步骤#2是运行<一href="https://gradle.org/docs/current/userguide/tutorial_gradle_command_line.html#para:commandline_dependency_report">the摇篮依赖性报告(例如,摇篮-q应用:依赖从项目的根目录)。这将提供ASCII树如在更新的问题,它可以帮助你确定哪些是要求冲突神器版本。

第三步是要决定哪些需要更换。您选择只更换冲突(支持-注释)。就个人而言,我会去与错误的版本树的根( recyclerview-V7 ),但就我所知,可能不采取行动在这当然最好案例。

第四步是添加排除指令来阻止你选择了什么步骤#3:

  androidTestCompile('com.android.support.test.es preSSO:ES preSSO-contrib请:2.0'){
    排除模块:支持,注解
}
 

步骤#5是测试赫克出这种变化。你在做什么是说, ES preSSO-的contrib 的应对22.0.0版的支持-注释。这可能工作。可能不会。这取决于冲突的向后兼容性。在这种情况下,支持-注释应该是pretty的好了。

步骤#6是消耗你选择的饮料,一是适合您的语言环境和一天中的时间。

After upgrading to API 22 and support lib revision 22 I'm getting the following warning:

Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (22.0.0) and test app (21.0.3) differ.

Gradle itself is more forgiving, but Android Studio, not so much.

I have no dependencies declared with 21.0.3 ... is one of the dependent libraries using 21.0.3 and Google forgot to update it with the rest of the batch?

My build.gradle with the extras cut out

android {
  compileSdkVersion 22
  buildToolsVersion '22'

  defaultConfig {
    applicationId "com.REDACTED.android"
    minSdkVersion 14
    targetSdkVersion 22
    renderscriptSupportModeEnabled true
    versionName '1.0.0'
    versionCode 100
  }

  buildTypes {
    release {
      minifyEnabled true
      zipAlignEnabled true
      signingConfig signingConfigs.release
    }

    debug {
      minifyEnabled false
      zipAlignEnabled true
      signingConfig signingConfigs.debug
    }
  }

  dependencies {
    provided 'org.projectlombok:lombok:1.16.2'
    googleCompile 'com.google.android.gms:play-services-base:6.5.87'
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:support-v13:22.0.0'
    compile 'com.android.support:cardview-v7:22.0.0'
    compile 'com.android.support:palette-v7:22.0.0'
    compile 'com.android.support:support-annotations:22.0.0'
    compile 'com.github.chrisbanes.photoview:library:1.2.3'
    compile 'org.apache.commons:commons-lang3:3.3.2'
    compile 'commons-io:commons-io:2.4'
    compile 'commons-codec:commons-codec:1.10'
    compile 'com.jakewharton:butterknife:6.1.0'
    compile 'com.jakewharton:disklrucache:2.0.2'
    compile 'com.squareup:otto:1.3.6'
    compile 'com.squareup.picasso:picasso:2.5.0'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp:2.2.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
    compile 'com.squareup.okio:okio:1.2.0'
    compile 'com.flaviofaria:kenburnsview:1.0.6'
    compile 'com.edmodo:cropper:1.0.1'
    compile 'com.getbase:floatingactionbutton:1.8.0'
    compile 'com.nispok:snackbar:2.10.2'
    compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
    compile 'in.srain.cube:grid-view-with-header-footer:1.0.9'
    compile 'de.hdodenhof:circleimageview:1.2.2'
    compile fileTree(dir: 'libs', include: '*.jar')
    // Test Only Dependencies
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
    androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
    androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.0'
  }

Update: (Thanks Mark)

Looks like it's espresso-contrib

+--- com.android.support.test:testing-support-lib:0.1 (*)
\--- com.android.support.test.espresso:espresso-contrib:2.0
     +--- com.android.support:recyclerview-v7:21.0.3
     |    +--- com.android.support:support-annotations:21.0.3
     |    \--- com.android.support:support-v4:21.0.3
     |         \--- com.android.support:support-annotations:21.0.3
     +--- com.android.support:support-v4:21.0.3 (*)
     \--- com.android.support.test.espresso:espresso-core:2.0 (*)

解决方案

Step #1 when dealing with this sort of thing is to get comfortable with command-line Gradle.

Step #2 is to run the Gradle dependencies report (e.g., gradle -q app:dependencies from the project root). This will provide the ASCII tree as shown in the update to the question, and it should help you identify what is asking for the conflicting artifact versions.

Step #3 is to decide what needs replacing. You elected to replace just the conflict (support-annotations). Personally, I would have gone with the root of the wrong-version tree (recyclerview-v7), though for all I know that might not be the best course of action in this case.

Step #4 is to add the exclude directive to block what you chose in Step #3:

androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {
    exclude module: 'support-annotations'
}

Step #5 is to test the heck out of this change. What you are doing is saying that espresso-contrib has to deal with the 22.0.0 edition of support-annotations. That may work. That may not. It depends on the backwards compatibility of the conflict. In this case, support-annotations should be pretty good about it.

Step #6 is to consume the beverage of your choice, one appropriate for your locale and time of day.

这篇关于解决版本的应用程序(22.0.0)和测试应用程序(21.0.3)的不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆