zoukankan      html  css  js  c++  java
  • AS 解决support-annotations版本冲突

    一、问题来源

      用gradle生成jar包:

    $ ./gradlew makeJar
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Could not determine the dependencies of task ':wySdk:lint'.
    > Could not resolve all artifacts for configuration ':wySdk:debugAndroidTestRuntimeClasspath'.
       > Could not resolve com.android.support:support-annotations:{strictly 26.1.0}.
         Required by:
             project :wySdk
          > Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints: 
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
               Constraint path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-annotations:{strictly 26.1.0}' because of the following reason: debugRuntimeClasspath uses version 26.1.0
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-media-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-utils:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-ui:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
    
       > Could not resolve com.android.support:support-annotations:27.1.1.
         Required by:
             project :wySdk > com.android.support.test:runner:1.0.2
             project :wySdk > com.android.support.test:runner:1.0.2 > com.android.support.test:monitor:1.0.2
          > Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints: 
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
               Constraint path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-annotations:{strictly 26.1.0}' because of the following reason: debugRuntimeClasspath uses version 26.1.0
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-media-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-utils:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-ui:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
    
       > Could not resolve com.android.support:support-annotations:26.1.0.
         Required by:
             project :wySdk > com.android.support:support-compat:26.1.0
             project :wySdk > com.android.support:support-media-compat:26.1.0
             project :wySdk > com.android.support:support-core-utils:26.1.0
             project :wySdk > com.android.support:support-core-ui:26.1.0
          > Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints: 
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
               Constraint path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-annotations:{strictly 26.1.0}' because of the following reason: debugRuntimeClasspath uses version 26.1.0
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-media-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-utils:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
               Dependency path 'wy_sdk:wySdk:unspecified' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-ui:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
    
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 1s

    二、解决方案

      在生成jar的build.gradle中的andorid节点里添加如下配置:

        // 解决support-annotations版本冲突
        configurations.all {
            resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
        }

      三、参考

      https://blog.csdn.net/burmem/article/details/80447642

      https://blog.csdn.net/stonenotes/article/details/78799690

      

    时常一个人发呆,看到宁静的天空。
  • 相关阅读:
    Yii2中把路由地址中的%2F改为/
    深度解析常用的软件开发模型
    MYSQL索引的类型和索引的方式
    mysql errno 150
    士兵杀敌(五)
    stringstream字符串流
    士兵杀敌(二)(线段树+树状数组)
    士兵杀敌(一)(树状数组)
    C语言文件读写操作总结
    BC第二场
  • 原文地址:https://www.cnblogs.com/pinweyshg/p/11988468.html
Copyright © 2011-2022 走看看