zoukankan      html  css  js  c++  java
  • 解决'androidx.arch.core:core-runtime' has different version for the compile (2.0.0) and runtime (2.0.1)

    先说原因,我们引用的包版本不同产生了冲突,所以编译不通过。解决的办法是在引用的时候排除一个版本,只留一个版本。

    解决过程:

    先找出哪些库引用了相同的库,仅仅是版本不同。

    gradle app:dependencies

    app换成你工程中的模块名,它会生成一个依赖列表,我们要做的是分析一下这个列表,比如我的引用就是:

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.google.android.material:material:1.0.0'
        implementation 'androidx.lifecycle:lifecycle-process:2.2.0-alpha04'
        implementation 'androidx.work:work-runtime:2.3.0-alpha01'
    }

    在编译的时候就产生了'androidx.arch.core:core-runtime' has different version for the compile (2.0.0) and runtime (2.0.1)错误
    我这个模块叫work,所以通过gradle work:dependencies得到一个列表:
    releaseUnitTestRuntimeClasspath - Resolved configuration for runtime for variant: releaseUnitTest
    +--- androidx.appcompat:appcompat:1.1.0
    |    +--- androidx.annotation:annotation:1.1.0
    |    +--- androidx.core:core:1.1.0
    |    |    +--- androidx.annotation:annotation:1.1.0
    |    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.2.0-alpha04
    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.2.0-alpha04
    |    |    |    |    --- androidx.annotation:annotation:1.1.0
    |    |    |    +--- androidx.arch.core:core-common:2.1.0-rc01
    |    |    |    |    --- androidx.annotation:annotation:1.1.0
    |    |    |    --- androidx.annotation:annotation:1.1.0
    |    |    +--- androidx.versionedparcelable:versionedparcelable:1.1.0
    |    |    |    +--- androidx.annotation:annotation:1.1.0
    |    |    |    --- androidx.collection:collection:1.0.0 -> 1.1.0
    |    |    |         --- androidx.annotation:annotation:1.1.0
    |    |    --- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
    |    +--- androidx.cursoradapter:cursoradapter:1.0.0
    |    |    --- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    +--- androidx.fragment:fragment:1.1.0
    |    |    +--- androidx.annotation:annotation:1.1.0
    |    |    +--- androidx.core:core:1.1.0 (*)
    |    |    +--- androidx.collection:collection:1.1.0 (*)
    |    |    +--- androidx.viewpager:viewpager:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    |    --- androidx.customview:customview:1.0.0
    |    |    |         +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |         --- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    +--- androidx.loader:loader:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
    |    |    |    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.0.1
    |    |    |    |    |    +--- androidx.annotation:annotation:1.0.2 -> 1.1.0
    |    |    |    |    |    --- androidx.arch.core:core-common:2.0.1 -> 2.1.0-rc01 (*)
    |    |    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
    |    |    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.2.0-alpha04 (*)
    |    |    |    |    |    +--- androidx.arch.core:core-common:2.0.0 -> 2.1.0-rc01 (*)
    |    |    |    |    |    --- androidx.arch.core:core-runtime:2.0.0 -> 2.0.1 (*)
    |    |    |    |    --- androidx.arch.core:core-common:2.0.0 -> 2.1.0-rc01 (*)
    |    |    |    --- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.1.0
    |    |    |         --- androidx.annotation:annotation:1.1.0
    |    |    +--- androidx.activity:activity:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.1.0
    |    |    |    +--- androidx.core:core:1.1.0 (*)
    |    |    |    +--- androidx.lifecycle:lifecycle-runtime:2.1.0 -> 2.2.0-alpha04 (*)
    |    |    |    +--- androidx.lifecycle:lifecycle-viewmodel:2.1.0 (*)
    |    |    |    --- androidx.savedstate:savedstate:1.0.0
    |    |    |         +--- androidx.annotation:annotation:1.1.0
    |    |    |         +--- androidx.arch.core:core-common:2.0.1 -> 2.1.0-rc01 (*)
    |    |    |         --- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.2.0-alpha04 (*)
    |    |    --- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.1.0 (*)
    |    +--- androidx.appcompat:appcompat-resources:1.1.0
    |    |    +--- androidx.annotation:annotation:1.1.0
    |    |    +--- androidx.core:core:1.0.1 -> 1.1.0 (*)
    |    |    +--- androidx.vectordrawable:vectordrawable:1.1.0
    |    |    |    +--- androidx.annotation:annotation:1.1.0
    |    |    |    +--- androidx.core:core:1.1.0 (*)
    |    |    |    --- androidx.collection:collection:1.1.0 (*)
    |    |    +--- androidx.vectordrawable:vectordrawable-animated:1.1.0
    |    |    |    +--- androidx.vectordrawable:vectordrawable:1.1.0 (*)
    |    |    |    +--- androidx.interpolator:interpolator:1.0.0
    |    |    |    |    --- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    --- androidx.collection:collection:1.1.0 (*)
    |    |    --- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
    |    +--- androidx.drawerlayout:drawerlayout:1.0.0
    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    --- androidx.customview:customview:1.0.0 (*)
    |    --- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
    +--- androidx.constraintlayout:constraintlayout:1.1.3
    |    --- androidx.constraintlayout:constraintlayout-solver:1.1.3
    +--- com.google.android.material:material:1.0.0
    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    +--- androidx.legacy:legacy-support-core-ui:1.0.0
    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    |    +--- androidx.documentfile:documentfile:1.0.0
    |    |    |    |    --- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    +--- androidx.loader:loader:1.0.0 (*)
    |    |    |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
    |    |    |    |    --- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    --- androidx.print:print:1.0.0
    |    |    |         --- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    +--- androidx.customview:customview:1.0.0 (*)
    |    |    +--- androidx.viewpager:viewpager:1.0.0 (*)
    |    |    +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    |    --- androidx.customview:customview:1.0.0 (*)
    |    |    +--- androidx.drawerlayout:drawerlayout:1.0.0 (*)
    |    |    +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    |    --- androidx.customview:customview:1.0.0 (*)
    |    |    +--- androidx.interpolator:interpolator:1.0.0 (*)
    |    |    +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    |    --- androidx.interpolator:interpolator:1.0.0 (*)
    |    |    +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    |    --- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    |    --- androidx.cursoradapter:cursoradapter:1.0.0 (*)
    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
    |    +--- androidx.fragment:fragment:1.0.0 -> 1.1.0 (*)
    |    +--- androidx.transition:transition:1.0.0
    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    |    --- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |    +--- androidx.appcompat:appcompat:1.0.0 -> 1.1.0 (*)
    |    +--- androidx.cardview:cardview:1.0.0
    |    |    --- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |    --- androidx.recyclerview:recyclerview:1.0.0
    |         +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
    |         +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
    |         --- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
    +--- androidx.lifecycle:lifecycle-process:2.2.0-alpha04
    |    --- androidx.lifecycle:lifecycle-runtime:2.2.0-alpha04 (*)
    --- androidx.work:work-runtime:2.3.0-alpha01
         +--- com.google.guava:listenablefuture:1.0
         +--- androidx.lifecycle:lifecycle-livedata:2.0.0 (*)
         +--- androidx.room:room-runtime:2.1.0
         |    +--- androidx.room:room-common:2.1.0
         |    |    --- androidx.annotation:annotation:1.1.0
         |    +--- androidx.sqlite:sqlite-framework:2.0.1
         |    |    +--- androidx.annotation:annotation:1.0.2 -> 1.1.0
         |    |    --- androidx.sqlite:sqlite:2.0.1
         |    |         --- androidx.annotation:annotation:1.0.2 -> 1.1.0
         |    +--- androidx.sqlite:sqlite:2.0.1 (*)
         |    +--- androidx.arch.core:core-runtime:2.0.1 (*)
         |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
         |    --- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
         +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
         --- androidx.lifecycle:lifecycle-service:2.0.0
              --- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.2.0-alpha04 (*)

    然后我们沿着树形结构可以找到,androidx.work:work-runtime:2.3.0-alpha01和 androidx.appcompat:appcompat:1.1.0中的core-runtime版本冲突了,解决的办法是去掉一个留一个,我是把work-runtime中的去掉了。如下:

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.google.android.material:material:1.0.0'
        implementation 'androidx.lifecycle:lifecycle-process:2.2.0-alpha04'
        implementation ('androidx.work:work-runtime:2.3.0-alpha01'){
            exclude group: 'androidx.arch.core'
        }
    }
  • 相关阅读:
    asp.net GDI+绘制矩形渐变
    asp.net GDI+把图片绘制成自定义的椭圆形状
    asp.net TreeView控件绑定数据库显示信息
    asp.net GridView控件中诗选全选和全不选功能
    PHP 笔记——会话控制
    PHP 笔记——String 字符串
    PHP 笔记——Web页面交互
    PHP 笔记——PDO操作数据库
    PHP 笔记——操作MySQL数据库
    PHP 笔记——Array 数组
  • 原文地址:https://www.cnblogs.com/gelandesprung/p/11496049.html
Copyright © 2011-2022 走看看