【问题标题】:All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0,所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0,
【发布时间】:2019-02-16 08:36:28
【问题描述】:

所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0、27.0.2。示例包括 com.android.support:animated-vector-drawable:28.0.0 和 com.android.support:cardview-v7:27.0。

无论我使用什么 API,都会出现同样的错误。

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

【问题讨论】:

    标签: android


    【解决方案1】:

    android 团队一直致力于将支持库迁移到 androidx。这使您可以更好地混合搭配。

    备份您的项目并在 android studio 中转到

    Refractor > 迁移到 AndroidX

    【讨论】:

    • 你的 gradle api 条目有变化吗?
    • yes 已更改,但它向我显示此错误错误:无法解析 ':app@debug/compileClasspath' 的依赖项:无法解析 androidx.constraintlayout:constraintlayout:1.1.2。显示详细信息 受影响的模块:app
    【解决方案2】:

    使用旧版本但使用新版本号显式添加库。

    在你的情况下implementation 'com.android.support:cardview-v7:28.0.0' 所以你需要添加:

    implementation 'com.android.support:cardview-v7:28.0.0'  
    

    ie:从第二项中获取库,并使用第一项中的版本号实现它。

    注意:不要忘记现在按同步

    现在更改后,您的依赖项将如下所示:

      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:28.0.0'
      implementation 'com.android.support:support-v4:28.0.0'
      implementation "com.android.support:support-media-compat:28.0.0"
      implementation "com.android.support:customtabs:28.0.0"
      implementation 'com.android.support:cardview-v7:28.0.0'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-14
      • 1970-01-01
      • 2019-07-05
      相关资源
      最近更新 更多